Operating System - HP-UX
1823067 Members
3220 Online
109645 Solutions
New Discussion юеВ

preserving time stamp information during FTP file transfer

 

preserving time stamp information during FTP file transfer

Hi,

Can I preserver time stamp details of a file when getting a file from remote server using FTP ?

Remote server is not a unix system (otherwise, I would have used rcp) and it is a NT server having microsoft FTP.

Any suggestion?

Thanks & regards,
Jegi,
NBC, New York
11 REPLIES 11
Sanjay_6
Honored Contributor

Re: preserving time stamp information during FTP file transfer

Hi Jegi,

Don't think there is a way to preserve the timestamp of a file when transferred using ftp.

quote //

There is not a way to keep the original date and time of a file after transfer using ftp. There is not any specific information regarding file date and time in the RFC959 for ftp. However, it is evident that when a file is transferred from a client to server, the file is initially created at this point (showing current date and time) and then the contents are copied over to complete the file transfer.

Note: when a file transfer takes place, if the transmission process is aborted or disconnected, the file will exist on the remote host and will show a zero byte file with the current date and time. Therefore, it is determined that date stamp of files is being done within the ftp code, which is working by design.

//unquote

hope this helps.

thanks
Alan Riggs
Honored Contributor

Re: preserving time stamp information during FTP file transfer

Sanjay is correct. FTP will not preserve modification tine. You can preserve modification times with rcp (-p flag) if that is an option in your environment.
Uday_S_Ankolekar
Honored Contributor

Re: preserving time stamp information during FTP file transfer

Hi,

You can not preserve time stamp with ftp.
How about trying pcmount, Mounting the direc
did you try NT rcp command..??

-USA...
Good Luck..
Paula J Frazer-Campbell
Honored Contributor

Re: preserving time stamp information during FTP file transfer

Hi

Two possibilities:-

gzip the files and then ftp them
or tar up the files then ftp then

then upack at the other end.

I an not 100% sure but I believe one works.


HTH

Paula
If you can spell SysAdmin then you is one - anon
Paula J Frazer-Campbell
Honored Contributor

Re: preserving time stamp information during FTP file transfer

Hi
I should have said winzip also.

Paula
If you can spell SysAdmin then you is one - anon
A. Clay Stephenson
Acclaimed Contributor

Re: preserving time stamp information during FTP file transfer

Hi:

While not a perfect solution, I can think of one way to do this. After your transfer the files to your NT box you run a perl script on your unix box which prints a line containing the filename, the atime (in epoch seconds), and the mtime (in epoch seconds) for each file transferred. We call this file, 'TimeStamp.txt' and transfer it to the same directory.

On the NT side, you have a perl script which reads this file and calls the utime function to set the atime and mtime for each file and then remove the TimeStamp.txt file. The perl script on the NT side could be a daemon.

This is probably only about 10 minutes of perl on each end. You could also use the perl FTP module to automate the transfers.

If it ain't broke, I can fix that.
Deepak Extross
Honored Contributor

Re: preserving time stamp information during FTP file transfer

Hi,

I second Paula's suggestion of tarring/zipping the files before ftp'ing.

However, note that this will not only preserve the timestamp but also the ownership and permissions of the files.
Sharon Prothero
Frequent Advisor

Re: preserving time stamp information during FTP file transfer

This probably won't solve your problem, as it only seems to work when getting from a remote source to NT box, but other folks may find it useful.
If you can control things from the NT end, try "leech ftp". This has a GUI front-end to allow you to drag'n'drop files, and whole directory trees (handy in itself). If you get from UNIX on to NT ("downloading" in Leech-speak) the time stamps are preserved, unfortunately when putting (Leech-speak "upload") to a UNIX box the files get new time stamps.
Sadly development of this software stopped about 18 months ago, but I have been using it quite happily for about four years. The URL is http://stud.fh-heilbronn.de/~jdebis/leechftp/. I have attached the download file.

By the way, to keep timestamps from NT to HPUX I would zip 'em first too !!
harry d brown jr
Honored Contributor

Re: preserving time stamp information during FTP file transfer

I concur with DeePak Extross, that Paula has the solution. Tar or gzip the file(s) before the FTP, but as DeePak Extross pointed out, that the permissions and ownerships will be brought over also.

live free or die
harry
Live Free or Die
Frank Slootweg
Honored Contributor

Re: preserving time stamp information during FTP file transfer

Building on Paula's (and Deepak's, Sharon's and Harry's) suggestions:

Both HP-UX and Windows NT have the pax(1) utility for archiving/extracting files. pax(1) preserves time stamps.

pax(1) is a standard utility which has its origins in the UNIX world (XPG standard), but is available on other platforms as well (POSIX standard). pax(1) can read and write in cpio(1) and tar(1) format, so for example you can archive your files with cpio(1), FTP the archive to NT and unpack the archive on NT with pax(1).

For the HP-UX version, see the pax(1) manual page.

For the NT version, see Start -> Help -> Windows NT Commands -> Windows NT Commands -> P -> pax.
John Bolene
Honored Contributor

Re: preserving time stamp information during FTP file transfer

Another faithful follower of leech ftp.
Much easier to use than any other ftp program I have seen.

Another benefit is that you can set the max bandwidth to be used so that you don't hog the line.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com