I'm trying to Rename a File using Java But It is Not Working for Some Reason -
file oldfile = new file("c:\\newtext document.txt"); file newfile = new file("c:\\hello buddy.txt"); if (oldfile.renameto(newfile)) { system.out.println("rename succesful"); } else { system.out.println("rename failed"); }
i'm planning on developing file normalizer, want done first. i've tried using absolute path, makes no difference. returning "rename failed".
use move method of files class. worked me ;)
Comments
Post a Comment