rp0428 wrote:you realize we are talking about java code here, not command line tools?
The method has an unfortunate name. Actually, it can move a file.
Please post a sample of a rename that moves a file on windows.
On WinXP SP3 you can't do it.
Renames a file or files.
RENAME [drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.
Note that you cannot specify a new drive or path for your destination file.
Actually this is the same behavior you see when using the standard C library. The C function rename will not change a name across file systems (or drives if on windows) either.Of course it won't. That's because it calls MoveFile() under the hood. Nothing else it can sensibly do.
Based on the javadocs for File.renameTo( ), I would suspect in some implementations it may just be a wrapper call to the standard C library rename function.Or the MoveFile() function. It really doesn't matter which.
EJP wrote:I need to move file from folder A in C:\ to folder B in D:\ without changing file creation time.
The relevance of the Windows command-shell REN command to the File.renameTo() method escapes me..............which can certainly move files across folders, although not across file systems.