I was looking at Class File and didn't find any move and copy method() in that File Class. Does any other class provide move and copy functionality ? I want to move and copy files from one directory to another directory by a java program? Is it possible? How ? Please let me know? Thanks.
From the JDK docs it looks like 'renameTo' will set the entire file path. That may be a solution for a 'move' so long as you don't meant to move the file to another device. Otherwise you can do a copy then delete the original. For copying you can create a new file and use standard IO routines to read the contents of one file and write them to another file. Then you can call 'setLastModified' on the destination file so that it matches the modified time of the original file.