I need to transfer some 100 files using SFTP into my remote directory in to the other machine..And i have develop a script that could done my task !...This script will read all the content of files in the local directory then transfered it one-by-one. After transferd one file, these file will be removed..And the provcess will go on until all the files are transfered and remove successfull ..Below is my script...
use Net::SSH::Perl; use Net::SFTP; $host = '***.***.***.***'; $username = 'zaki'; $passwd = 'zaki'; $remote_path = '/home/roime/'; $local_path = '/flow/flow'; chdir $local_path or die "Could Not Change Dir To $local_path!"; opendir(FILE, $local_path) || die("Cannot open directory"); @files=readdir(FILE); closedir(FILE); foreach $file(@files) { next if(-d $file); next if($file eq ".flow"); { $sftp=Net::SFTP->new($host, user => $username, password => $passwd, debug => 0) or die "Cannot connect to $host:$@"; $sftp->put("$file", "$remote_path") or die "...problem !..."; $sftp->ls($remote_path); unlink("$local_path$file") or die "having trouble deleting $file:$!";; print "$file deleted success....\n"; } } sub usage { my($name) = $0; $name =~ s/.*\///; print STDERR "Usage: $name <host> <username> <passwd> <remote_path> <local_path>\n"; exit; } After i execute it, i receive this error message and I need you guy opinions about this error...Thanks... Couldn't get handle: Failure at /usr/lib/perl5/site_perl/5.8.0/Net/SFTP.pm line 168. Couldn't write to remote file: Failure at /usr/lib/perl5/site_perl/5.8.0/Net/SFTP.pm line 263. Couldn't close file: No such file or directory at /usr/lib/perl5/site_perl/5.8.0/Net/SFTP.pm line 203. ...problem !... at rput.pl line 40. __________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>