Changing timestamp of FTP?

Alles, was den Apache betrifft, kann hier besprochen werden.

Changing timestamp of FTP?

Postby randy_ortan » 30. December 2009 12:53

I am using apache commons-net-1.4.1.jar for FTP file transfer in my Java application.

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.
Posts: 1
Joined: 30. December 2009 11:21

Return to Apache

Who is online

Users browsing this forum: No registered users and 5 guests