Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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();

In reply to Net::FTP::Recursive question by sivak1976

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2022-05-24 03:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?