Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Preserving timestamps with Net::FTP

by RhetTbull (Curate)
on Jun 25, 2001 at 23:48 UTC ( [id://91407]=note: print w/replies, xml ) Need Help??


in reply to Preserving timestamps with Net::FTP

Try this:
#get the modification time of the remote file #assuming $ftp is a Net::FTP object my $mtime = $ftp->mdtm($file); #download the file $ftp->get($file); #set the time of the local file # (assumes $file is also the local file name) utime $mtime, $mtime, $file;
Regards,
Rhet

Update: I think I may have misunderstood your question. If you are wanting to change the time on the remote files (e.g. you are using Net::FTP to upload them to remote servers) then I'm not sure how to do it. However, one solution (kludge) could be to upload the files to the remote machines then change the time on all the local files to the current time:
my $now = time; utime $now, $now, @localfiles;

Update #2: Another solution (also a kludge but it would work) would be to keep a logfile for each machine with the filenames and times. Then you could just parse the logfile and compare to your local files to see what needs to be uploaded.

Replies are listed 'Best First'.
Re: Re: Preserving timestamps with Net::FTP
by IraTarball (Monk) on Jun 25, 2001 at 23:52 UTC
    Ahh, but I'm 'put'ting the file, not 'get'ting it. So I can't do a utime on the file without executing a remote command, which I'm really trying to avoid for other reasons.

    "So... What do all these little arrows mean?"
    ~unknown

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://91407]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found