----- Original Message ----
> From: "Arifuddin, Arif" <Ari...@xe...>
> To: ssh...@li...
> Sent: Fri, October 30, 2009 1:31:28 AM
> Subject: [Ssh-sftp-perl-users] Net::SFTP::Foreign; results
>
>
> Help: i have the following script running but i get the results as such?
>
> #!/usr/bin/perl
> use lib '../modules';
> use strict;
> use Net::SFTP::Foreign;
> $|=1;
> print "Connecting...";
> my $sftp = Net::SFTP::Foreign->new('ipaddress',
> user=>'xyz',
> password=>'123');
> if (not $sftp) {
> die("Error: No Connection:$@");
> }
> elsif ($sftp->error) {
> die("Connect Failed : ".$sftp->status);
> }
> else {
> print "Connected!\n";
> if (!$sftp->rget("/from*", "/to")) {
> print "Failed to Transfer: ".$sftp->error;
> }
> else {
> print "Transfer Done!!";
> }
> print "\nFinished\n";
>
> end of script:
>
> Why am i getting the following result....if someone can help?
>
>
> Connecting...Connected!
> Failed to Transfer: Couldn't stat remote file (lstat): No such file
"rget" does not understand willcards.
You can do it as follows:
my @from = $sftp->glob("/from*");
for my $from (@from) {
$sftp->rget($from, "/to")
or print "unable to retrieve $from: ". $sftp->error;
}
- Salva
|