Monday, February 14, 2005 03:24 AM
renameTo should work unless the directories are on different disks. In that case anything that moves the file is going to have to rewrite it. Unfortunately in Java, there is no way to control the timestamps easily.
There are some non-cross-platform ways of doing this: Either find a command line that will move the file properly and call it via Runtime.exec(), or write some native code.