Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How to retrieve files at least 5 minutes old using sftp foreign

by atcroft (Monsignor)
on Nov 06, 2013 at 18:12 UTC ( #1061458=note: print w/replies, xml ) Need Help??


in reply to How to retrieve files at least 5 minutes old using sftp foreign

Take a look at Net::SFTP::Foreign::Attributes (included in Net::SFTP::Foreign)-it includes methods for looking at the atime and mtime of the files. Depending on if the machines' clocks are close, then something like the following (untested) snippet might do the trick (derived from the docs):

my $t = time; foreach my $f (@list) { if ( $f->{mtime} + 300 < $t ) { # retrieve $f->{filename} here } }

Hope that helps.

  • Comment on Re: How to retrieve files at least 5 minutes old using sftp foreign
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1061458]
help
Chatterbox?
NodeReaper updates his toe tag collection database

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2017-03-26 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (315 votes). Check out past polls.