I have this java code that renames a file (or directory). There is a problem on Linux when I use some special characters, it works on Windows with these special characters. The way I try it is like this: In windows
I create a direcotory called "326½_6"
I build a jar-file, and call it (java -jar) directly in the windows cmd (or linux shell), first param is the directory above, second param is a path to a new directory. This works
I then transfer the directory to a Linux server using SFTP (WinSCP). I repeat the steps above, but it doesn't work. I get this output:
Moving /home/user/testarea/326�_6/ to /home/user/testarea/test5/
--- could not perform rename -------
Is there anyway to make this work on a Linux machine???
the code:
public static void main(String [] args) {
String source = args[0];
String dest = args[1];
System.out.println(" - Moving " + source + " to " + dest);
File sourceFile = new File(source);
File destinationFile = new File(dest);
if (!sourceFile.renameTo(destinationFile)) {
System.out.println("--- could not perform rename -------");
}
System.out.println("Finished moving");
}
thanks!