sivak1976 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl # Program to recursively put a directory on to an FTP server # after unzipping a Zip file. use strict; use warnings; use Net::FTP::Recursive; use Archive::Zip; # FTP host server my $host = 'myhost.mydomain.com'; my $zip_file_to_put = 'ABC.zip'; # Get the zip archive. my $zip_file_obj = Archive::Zip->new($zip_file_to_put) or die("Could not get zip file: $!"); # Extract the zip files. $zip_file_obj->extractTree(); chdir('ABC') or die("Could not change directory: $!"); # my $current_dir = `pwd`; # print $current_dir, "\n"; my $ftp_obj = Net::FTP::Recursive->new($host, Passive => 1) or die "Cannot connect to $host: $!" ; # Log in to the FTP server. $ftp_obj->login('username', 'password') or die "Cannot log in to $host +: $!" , $ftp_obj->message(); # Go into binary mode for the transfer my $type = $ftp_obj->binary(); # Put the directory in a recursive fashion. my $output = $ftp_obj->rput(); # Print the error messages if the recursive put failed. if($output) { print qq<rput failed, \$output was:\n$output>; } # Quit! $ftp_obj->quit();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Net::FTP::Recursive question
by snoopy (Curate) on Aug 01, 2007 at 00:33 UTC | |
by sivak1976 (Novice) on Aug 01, 2007 at 13:47 UTC | |
by regexes (Hermit) on Aug 01, 2007 at 14:35 UTC | |
by snoopy (Curate) on Aug 02, 2007 at 00:12 UTC |