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

Re^3: Doing an 'ls' in SFTP:Foreign

by salva (Abbot)
on Feb 21, 2013 at 09:13 UTC ( #1019923=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Doing an 'ls' in SFTP:Foreign
in thread Doing an 'ls' in SFTP:Foreign

Just loop over the returned values generating a new list with the fields you want to keep:

my $ls = $sftp->ls('/home/ftptest/inbound', no_wanted => qr/^\./ ); my @names_and_sizes = map { { filename => $_->{filename}, size => $_-> +{a}->size } } @$ls; # or... my %size = map { $_->{filename} => $_->{a}->size } @$ls;


Comment on Re^3: Doing an 'ls' in SFTP:Foreign
Download Code
Replies are listed 'Best First'.
Re^4: Doing an 'ls' in SFTP:Foreign
by StarkRavingCalm (Sexton) on Feb 21, 2013 at 15:05 UTC

    Perfect!

    $VAR1 = { 'text.txt' => 0, '1.1' => 0, 'newfile' => 171, 'upfile1' => 0, 'newfile3' => 171, 'upfile2' => 0, 'upfile3' => 0, 'upfile4' => 312, 'slkdjslkd.lkjlsdfsdl' => 0, 'newfile2' => 171 };

    Thanks Salva!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (18)
As of 2015-07-28 20:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls