Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: using sftp to get file information for processing

by Tomte (Priest)
on Aug 05, 2004 at 18:14 UTC ( [id://380344]=note: print w/replies, xml ) Need Help??


in reply to using sftp to get file information for processing

This part of your code works here:

[2005]tom@margo ~ $ perl use Net::SFTP; use Net::SFTP::Attributes; my $sftp = Net::SFTP->new('test2.dievision', user => 'MYNAME', passwor +d => 'MYPASSWORD', debug => 1); $sftp->ls('/(some/dir', sub {print STDERR "$_[0]->{filename}\n"}); 1;
I get a whole lot of debug information, and the file-listing as expected. Changing the anonymous sub to:
$sftp->ls('/some/dir', sub {my $attrs = $sftp->do_stat($_[0]->{filenam +e}); print STDERR $_[0]->{filename}, " ", $attrs->gid, " ", $attrs- +>size, "\n"});
resulted in correct answers as to gid and size; are you sure the connection is working correctly?

regards,
tomte


An intellectual is someone whose mind watches itself.
-- Albert Camus

Replies are listed 'Best First'.
Re^2: using sftp to get file information for processing
by jblapham (Novice) on Aug 06, 2004 at 20:33 UTC

    Thanks everyone for the input. I was able to get it working very well. The only outstanding issue is the ability to capture the result of the sftp->get command. It doesn't appear to give a return code and I don't know what all the possible textual responses are from this command. Does anyone have any ideas?

    Just for your viewing, here is the code now. Ignore the junk around the get. I just haven't cleaned up stuff that doesn't work (but doesn't hurt).

    Thanks, Jim

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 22:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found