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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.