Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Net::SSH2 list files

by WhiskeyJack (Initiate)
on Aug 08, 2012 at 12:13 UTC ( #986244=note: print w/ replies, xml ) Need Help??


in reply to Re: Net::SSH2 list files
in thread Net::SSH2 list files

Thanks for replying salva!

The problem I have is that I can't figure out a way to read the entries. I can't use Net::SFTP::Foreign at all since I'm on a windows and cygwin is not responding to my pleading :D Is there some other way to get this information from the opendir command?


Comment on Re^2: Net::SSH2 list files
Re^3: Net::SSH2 list files
by salva (Monsignor) on Aug 08, 2012 at 12:21 UTC
    # untested! my $sftp = $ssh2->sftp; my $dh = $sftp->opendir($dir); while (my %entries = $dh->read) { print "$_\n" for keys %entries; }

    BTW, Net::SFTP::Foreign works with ActiveState and Strawberry versions of perl.

      When I run it I just get:

      uid, mode, mtime, name, atime, size, gid, uid

      Over and over again instead of getting the 3 files in the folder I defined :(

      Still thank you for trying!

      Net::SFTP::Foreign needs IO/Pty.pm which is only supported on windows if you run it with cygwin which for me still creates a bunch of problems :(

        Ok, try this one:
        # untested again! my $sftp = $ssh2->sftp; my $dh = $sftp->opendir($dir); while (my %e = $dh->read) { print "$e{name}\n"; }

        Net::SFTP::Foreign does not require IO::Pty when you use it with the Net::SSH2 backend.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2014-09-18 16:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (119 votes), past polls