Java examples for File Path IO:File Rename
Renaming a File or Directory
import java.io.File; public class Main { public void m() { // File (or directory) with old name File file = new File("oldname"); // File (or directory) with new name File file2 = new File("newname"); // Rename file (or directory) boolean success = file.renameTo(file2); if (!success) { // File was not successfully renamed }//w w w. j a v a2 s . c om } }