Sep 23

Use the File classes renameTo() method. Remember to check the return value which indicates whether the renaming was successful.


// file to be renamed

File from = new File(renameFrom);
    
// What to rename it to

File to = new File(renameTo);

if (!from.renameTo(to))
{
   // Rename failed
} 

written by objects \\ tags:


Leave a Reply

You must be logged in to post a comment.