1

I am trying to download the files from a remote MFT server using Strawberry perl but I do not get any output or error on the screen. I am using Strawberry PERL on a windows machine.

I have tried using Net::SFTP::Foreign module but could not resolve the issue.

use strict;
use warnings;
use File::Slurp qw(read_file write_file);
use Getopt::Long;
use Log::Log4perl qw(:easy);
use Net::SFTP::Foreign;
use Net::SFTP::Foreign::Backend::Net_SSH2;

my $sftp = Net::SFTP::Foreign->new($host,
                                   backend => 'Net_SSH2',
                                   username => $user,
                                   password => $pass);
$sftp->error and
  die "Unable to stablish SFTP connection: ". $sftp->error;

my $ls = $sftp->ls("$MFTDIR");
print $ls;

I am expecting to see the list of files on the server to start with. But it is not showing anything. Next step would be to download the files.

  • Enable debug mode for Net::SFTP::Foreign adding the following line at the beginning of the script: `$Net::SFTP::Foreign::debug = -1;` – salva Dec 04 '19 at 12:23

0 Answers0