----- Original Message ----- From: "Sisyphus" <[email protected]>

Adapted (and untested) from an actual script I use:
##############################
use warnings;
use strict;
use Net::SSH2;

my $server = 'server.nameer';
my $ssh2 = Net::SSH2->new;
die "can't connect" unless $ssh2->connect($server);

print "Connected\n";

die "can't authenticate"
unless $ssh2->auth(username => 'user',
                   password => 'pass');

print "Authenticated\n";

my $sftp = $ssh2->sftp;
$ssh2->debug(1);

my @files = qw (file1 file2 file3);
my $dir = '/directory/on/server';

#Upload
for(@files) {
  $ssh2->scp_put($_, "$dir/$_");
}

$ssh2->disconnect();
##########################

Hmmm ... not a very good adaptation - it actually uses scp, and $sftp is used only once.
See how you get on with it.

Cheers,
Rob

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to