----- Original Message ----- From: "Sisyphus" <sisyphus1@optusnet.com.au> > 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, RobThread Previous | Thread Next