![]() |
The Java Developers Almanac 1.4 |
|
e24. Renaming a File or Directory // 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
}
e20. Creating a File e21. Getting the Size of a File e22. Deleting a File e23. Creating a Temporary File e25. Moving a File or Directory to Another Directory e26. Getting and Setting the Modification Time of a File or Directory e27. Forcing Updates to a File to the Disk
© 2002 Addison-Wesley. |