|
Java™ by example!
|
|
|
How do I rename and delete a file?
Rename: Use the method renameTo in the File class. If the destination folder is different from the source folder, it will move the file to the destination folder. Eg.
Notice that, after renaming, getName returns the old filename. Bug? Anyone? Delete: Use the method delete in the File class. Eg.
Further Information
Author of answer: Joris Van den Bogaert
Comments
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|