(i.e: My original file name is "a.txt" and after moving its name is changed to "b.txt")
try {
File fileBeforeRename = new File("c:\\a.txt");
File fileAfterRename = new File("D:\\NewFolder\\b.txt");
boolean result = fileBeforeRename.renameTo(fileAfterRename);
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}
File fileBeforeRename = new File("c:\\a.txt");
File fileAfterRename = new File("D:\\NewFolder\\b.txt");
boolean result = fileBeforeRename.renameTo(fileAfterRename);
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}
No comments:
Post a Comment