开发者

FTP script retain timestamp of a file after put

I know that FTP开发者_如何学Go does not support transferring and retaining file date/time stamps Wondering if anyone has any ideas/scripts (Shell/perl) that would retain a transfered file's timestamp after a put operation?


Can you perhaps attempt to transfer your files in a tar file? Upon extraction from the .tar, timestamps will be restored.


ncftp is the standard upgrade over /bin/ftp. Check out ncftpput's -yoption:

-y Try using "SITE UTIME" to preserve timestamps on remote host. Not many remote FTP servers support this, so it may not work.

You might also rest assured knowing ncftp works great on a ton of platforms (Windows included)


  1. One option is rcp -p. I'm sure some equivalent exists for more secure scp as well.

  2. As noted by Autocracy, if you can, just tar/zip/otherwise archive the file before transferring and revert back. Unfortunately this doesn't always work - say if you don't have control/acces to the file's source server.

  3. Alternately, after "get"-ting the file via FTP, change timestamp to the correct one using Perl's utime() or Unix's touch command.

    The caveat is if you're putting the file onto a remote server, you need to connect (ssh/telnet/rsh) to run the touch command. Kinda cumbersome and not what I'd recommend, but a valid solution even for "put".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜