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 ;)

java doc


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -