Java examples for File Path IO:File Rename
Renaming files using File object
import java.io.File; import java.io.IOException; public class Main { public static void main(String[] arg) throws IOException { File f = new File("c:/myfile.txt"); if (f.renameTo(new File("c:/savedmyfile.txt"))) System.out.println("File renamed."); else/*w ww . ja v a 2 s.c om*/ System.out.println("File not renamed."); } }