in reply to Can you use Net::SCP to check if a remote dir exist before copying?
Or using Net::OpenSSH::Parallel:... use File::Basename; my $file = fileparse($path); $scp->scp($path, "$remote->{user}\@$remote->{host}:$destination/$file" +);
use Net::OpenSSH::Parallel; my $pssh = Net::OpenSSH::Parallel->new; for my $host (keys %$remotehosts) { my $remote = ...; $pssh->add_host($host => "$remote->{user}\@$remote->{host}"); } $pssh->push('*', command => 'test', '-d', $destination); $pssh->push('*', scp_put => $path, $destination); $pssh->run; for my $host (keys %$remotehosts) { $pssh->get_error($host) and print STDERR "Unable to copy file $path +to $host" }
|
|---|