Check to see if remote directory exists using Perl Net::SSH::Perl
I want to check if a directory exists on a report server using the Net::SSH::Perl module.
This command works:
my($stdout, $stderr, $exit) = $ssh->cmd("ls -al /home/mydir");
But how can I do like:
if ( ! -e "/home/mydir/mydir_1" ) {
mkdir "/home/mydir/mydir_1";
}
Any way to do this using this Perl module?
perlon the remote end as well, just use$ssh->cmd(qq{perl -wle 'exit -e shift' '$filename'})and then look at the exit code