Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

remote readdir

by deprecated (Priest)
on Aug 23, 2001 at 21:24 UTC ( [id://107414]=CUFP: print w/replies, xml ) Need Help??

Sure, it's an ugly hack. It's even downright insecure. But its pretty darn cool to be able to readdir on remote machines.
# telnet readdir replacement sub treaddir { # return an array of files/dirs from a remote host like readdir # using Net::Telnet my ($host, $user, $pass, $dir) = (@_); my $rhost = new Net::Telnet (Timeout => 10) or die "Net::Telnet coul +d not connect to $host\n"; $rhost -> open( $host ); $rhost -> login( $user, $pass ); # yes its a kludge. its the last element of ls -la my @filesdirs = map { (split m[\s+], $_)[8] } $rhost -> cmd(qq{ ls - +la $dir }); chomp @filesdirs; $rhost -> close(); return @filesdirs; }

Log In?
Username:
Password:

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

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

    No recent polls found