ibra has asked for the wisdom of the Perl Monks concerning the following question:
At the moment when the user enters the location they would like to place the file. If the location doesn't exist a file will still be created. for example: perl distributor.pl /home/user/testdir/test.txt /home/user/test in the second argument if test directory doesn't exist on one of the remote host a file called test will be created. Is there a away to stop this from happening and inform the user that the directory they have typed doesn't exist? Thank you#I have a hash for all the remote hosts my $remotehosts = { "78.example.com" => { user => 'user', host => '0.0.0.78', } "79.example.com" => { user => 'user', host => '0.0.0.79', } } $path = $ARGV[0]; $destination = $ARGV[1]; #the copy scp statement is in a while loop which loops through the key +s in the hash. $scp->scp($path, $remote->{user}.'@'.$remote->{host}.":".$destination)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can you use Net::SCP to check if a remote dir exist before copying?
by salva (Canon) on Apr 26, 2011 at 11:02 UTC |