Java tutorial
import java.io.File; public class Main { public static void main(String[] argv) { // Rename old-dummy.txt to new_dummy.txt File oldFile = new File("old_dummy.txt"); File newFile = new File("new_dummy.txt"); boolean fileRenamed = oldFile.renameTo(newFile); if (fileRenamed) { System.out.println(oldFile + " renamed to " + newFile); } else { System.out.println("Renaming " + oldFile + " to " + newFile + " failed."); } } }