preserve mtime when using FTP?

G

greg

I am using Net::FTP to copy files, but the file stats are not
preserved. In particular, I would like to preserve mtime (time of last
modification).

There is an FTP mtime method that can get the mtime of the remote file.

Is there any way to preserve or set mtime, or is there a different
protocol or library I should use?

Thanks,
Greg
 
G

greg

Unless I am mistaken I don't think sftp will preserve the file
metadata. I don't know how ssh would either. sftp and ftp use
File.open( local_path, "wb" ) { |f| f.write contents }

After looking through the FileUtils source which can preserve metadata,
I see it just uses File.utime to set the metadata, so that is what I
will try.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top