FTP file copy problem?

FTP file copy problem?

Hi,

Can any one tell me how to set file lastModifiedTime after copying files through FTP. I am using commons-net-1.4.1.jar to copy files from local system to server.
Eg: local file name ?test.doc? (Today, December 29, 2009, 5:09:33 PM) when I moving this file to server, the files are moved successfully but the time is updated as server current time. But I need local file time like (Today, December 29, 2009, 5:09:33 PM). Below code I am using for uploading files to server.
[code]
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.");
}
[/code]
And also I tried with the below code itself
[code]
FTPFile ftp1 = new FTPFile();
String path = ftpRemoteDirectoryPath+localFileName;
System.out.println("The Current File Path is ------->"+path);
ftp1.setRawListing(path);
...
ftp1.setTimestamp(cal);
[/code]
The above code is not working. Can anyone please suggest me how solve the problem.
View Answers

January 15, 2010 at 3:27 PM

Hi,
any one please give the reply.









Related Tutorials/Questions & Answers:
FTP file copy problem? - Java Beginners
how to copy the directory in to ftp server using java
Advertisements
Java upload file to ftp
ModuleNotFoundError: No module named 'problemo'
copy file - Java Beginners
Copy .mdb file for backup.
Java FTP file upload example
php download file from ftp
How to upload file on FTP Server
FTP Server : Upload file
FTP Server : Download file
FTP FILE UPload - JSP-Servlet
Java Copy file example
File Upload in FTP - JSP-Servlet
FTP File Upload in Java
Copy one file into another
How to copy a file in java
how to upload file using FTP in java
How to copy a file
Copy Directory or File in Java
What is FTP (File Transfer Protocol)?
Delete a file from FTP Server
copy file from folder to folder - Java Beginners
apache commons io copy file example
File copy through intranet - Java Beginners
PDF Copy(File) has many pages.
File copy from one directory to another in java
Copy file in php, How to copy file in php, PHP copy file
how to copy file from one directory to another in java with examples
File copy from one drive to another. - Java Beginners
Copy a file to other destination and show the modification time of destination file
FTP Hosting
How to copy many files into one file and how to manage the content of the final file?
arraylist problems?
ftp server
ftp server
ftp server
Problems in Stringtokenizer
Problems in Stringtokenizer
Problems in Stringtokenizer
FTP Server
Search file on Ftp Server
Copy text file in a HTML form.
ftp - Java Beginners
ModuleNotFoundError: No module named 'problems'
Get all file size on FTP Server
Java FTP Library
FTP server
Java FTP Client Example
Java FTP jar

Ads