Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Getting information about a remote file via SSH: how to escape the filename

by salva (Abbot)
on Jun 27, 2013 at 12:24 UTC ( #1041003=note: print w/replies, xml ) Need Help??


in reply to Getting information about a remote file via SSH: how to escape the filename

Net::OpenSSH can do it for you:
use Net::OpenSSH; my $ssh = Net::OpenSSH->new($remotehost, user => $remoteuser, password + => $remotepassword); $ssh->die_on_error("unable to connect to remote host"); my ($out, $err) = $ssh->capture2(ls => '-l', $remotefile);

Another option is to use SFTP:

use Net::SFTP::Foreign; use Data::Dumper; my $sftp = Net::SFTP::Foreign->new($remotehost, user => $remoteuser, password => $r +emotepassword, autodie => 1); my $attr = $sftp->stat($remotefile); print Dumper $attr;

Replies are listed 'Best First'.
Re: Getting information about a remote file via SSH: how to escape the filename
by jonadab (Parson) on Jun 27, 2013 at 14:24 UTC

    Thanks. I will definitely look into Net::OpenSSH; that seems like a good way to go for this project.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041003]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2016-12-10 10:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (161 votes). Check out past polls.