http://www.perlmonks.org?node_id=629867

sivak1976 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use Net::FTP::Recursive to unzip an Archive file (.zip) and recursively transfer the directory created to an FTP server. The problem is that my code gives no error messages but the directory is not transferred. The user I am running this program as is able to create directories when using interactive FTP. Also, my code that uses the rget() method of the same module works just fine. It's just that I cannot get the rput() method to work. Code is below. Thanks in advance, sivak1976
#!/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();