renaming files in Java
Dear all,
I have a written a TCP Client/Server application where clients can upload files to a server
My main problem is that when an upload is finished I can not rename the file. First a part file is created so if the user wants to upload a file called 'myfile.pdf' the server will save data into a file called 'myfile.pdf.part'. What I want to do is at the finish of the upload to rename the file from 'myfile.pdf.part' to 'myfile.pdf'.
I tried the File.renameTo(File) method in the Java File API but it did not work. I also tried the FileUtils apache commons API but neither this worked.
Can anyone please advise me how is to possible to rename or move in a unix style a file?
|