thclpr
thclpr

Reputation: 5938

How to create a Zip file on a remote server in perl

actualy im using Net::FTP::Recursive to download a directory structure , it works nice for what is required. But since some folders have more than 100/ files, downloading then can take ages. Since a zip file is faster do download, how i could, using perl connect to a remote server via ftp and create a zip file from the remote server/folder to download ?

use Net::Config;
use Net::FTP::Recursive;


$ftp = Net::FTP::Recursive->new("$hostname:$ftp_port",  Debug => 0)
or die "Cannot connect to $hostname: $@";
$ftp->login($iLogin,$iPass)
or die "failed ", $ftp->message;
$ftp->binary()
or die "Cannot set to Binary";
$ftp->cwd("/admin/packages/$fileName")
or die "Cannot change working directory ", $ftp->message;
$ftp->rget( $fileName );
#or die "Download Failed ", $ftp->message;
$ftp->quit;

Thank you all for your time

Upvotes: 0

Views: 983

Answers (2)

StanleyZ
StanleyZ

Reputation: 607

The site(ARGS) method is designed for that. You can send a shell command and make it runs on remote server. http://perldoc.perl.org/Net/FTP.html#METHODS

However, most of the FTP servers I know disabled that permission, so, good luck

Upvotes: 1

farhany
farhany

Reputation: 1521

I think you'd need to have SSH access to the system to run a ZIP command. But if that's the case, you could also use SCP to transfer your files more securely. FTP does everything in the open.

Thanks,

F.

Upvotes: 1

Related Questions