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


in reply to Net::FTP::Recursive question

Are you running on Windows? There's an active bug report on Net::FTP::Recursive 2.00, raised on June 22.

"Net::FTP::Recursive uses by default the 'ls' command to list directories.

This obviously won't work if that command isn't available, or is not in the path (such as on Windows). Also, it can cause issues if the module is used with Perl's taint checking turned on."

If so, you may want to email the author. In the interim, you could work around it in your rput call:
# Put the directory in a recursive fashion. my $output = $ftp_obj->rput( Command => '', ParseSub => sub { # code to get files # in current working directory }, );

Replies are listed 'Best First'.
Re^2: Net::FTP::Recursive question
by sivak1976 (Novice) on Aug 01, 2007 at 13:47 UTC
    I am running on Linux so the "ls" command is available. Also, there is no error message warning me of anything. If I run the program on Windows, I get an error message.
      Hello,

      I think that is exactly soopy's point. If you are running the script on a Linux machine, you will not have the error because "ls" is the usual command for listing directory contents.

      The "ls" command does not exist on a Windows machine. So the error occurs.

      Or are you are running your script from a Linux machine and trying to recursively put to a Windows machine? Doesn't matter... it still won't work because the "ls" command on the Windows box will fail. It doesn't exist.

      regexes
      Hmmm. Your code works for me under Linux. Some other suggestions:

    • It's not just that the files ending up where you expect? The contents of ABC are going to the home directory. If your intention is to replicate ABC directory. You'll need to create it and cd to it yourself:
      $ftp_obj->mkdir('ABC'); # make sure the directory exists $ftp_obj->cwd('ABC') || die $ftp_obj->message;;
    • Set Debug => 1 when you open the ftp object. It'll give you lots of useful debugging info.