Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^5: Net::SFTP::Foreign getting files

by salva (Abbot)
on Apr 11, 2013 at 15:14 UTC ( #1028181=note: print w/ replies, xml ) Need Help??

in reply to Re^4: Net::SFTP::Foreign getting files
in thread Net::SFTP::Foreign getting files

yes, glob also accepts Perl regular expressions:

... my $start = quotemeta "$file$yesterday"; my ($file) = $sftp->glob(qr/^$start\d{6}$/, names_only => 1); ...
But there are easier ways to do what you want. For instance, you can use a regular expression matching all the prefixes in @ai_files_day plus $yesterday plus any six digits and let mget download all the files matching:
$sftp->setcwd($ai_dir); my $starts = join('|', map quotemeta, @ai_files_day); $sftp->mget(qr/^(?:$starts)$yesterday\d{6}$/, $ai_dest_day);

Comment on Re^5: Net::SFTP::Foreign getting files
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2015-11-26 05:03 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls