下面的程序正在从 SFTP 服务器下载文件,但我想在localdirectory
fromsftpdirectory
的文件列表中创建一个 .listing 文件。如何使用 Net::SFTP::Foreign 创建它?
#!/usr/bin/perl
use strict;
use warnings;
use Net::SFTP::Foreign;
my $sftp = Net::SFTP::Foreign->new(
'username@hostname',
password => 'password',
more => ['-v']
);
$sftp->get('sftpdirectory/data.zip', 'localdirectory')
or die "unable to retrieve copy: ".$sftp->error;
$sftp->disconnect;