When files are uploaded to server using FTP, modified time of file being uploaded is changed to current time instead of actual modified time of file in local system.
For eg, consider the file to be uploaded to server is “test.doc”. Modified time of this file in local system is “2009-12-30 2.30pm”. And when this file is uploaded to server at 5.30 pm, after upload, the time stamp of the file uploaded to server is changed to “2009-12-30 5.30 pm” instead of keeping the actual time stamp “2009-12-30 2.30pm”.
Following is the part of my java code which stores file to server.
- Code: Select all
File f = new File(localfilePath);
System.out.println("Storing file as remote filename: " + f.getName());
boolean retValue = ftp.storeFile(f.getName(), new FileInputStream(f));
if (!retValue) {
throw new Exception ("Storing of remote file failed. ftp.storeFile()" +
" returned false.");
}
Does apache commons package contain any methods for setting the time stamp of file uploaded in server?
Is any other FTP package available which overcomes the issue stated above?
Thanks in advance.