Help with FTP and then Tar in perl
I need to FTP to a server, tar all of the files in a directory, then FTP the tar to a different server.
Once I have the tar placing it on a server is not a problem but I have had trouble trying to figure out how to use Archive::Tar and Net::FTP开发者_JAVA百科 together.
You'll need to use ssh or something similar to submit a command on the remote server to create the tar file. The you'll be able to use Net::FTP to retrieve the resultant file.
From documentation of Archive::Tar:
use Archive::Tar;
my $tar = Archive::Tar->new;
$tar->add_files('file/foo.pl', 'docs/README');
$tar->write('files.tgz', COMPRESS_GZIP);
精彩评论