Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by salva (Canon)
on Feb 21, 2013 at 09:13 UTC ( [id://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;

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1019923]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found