Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Net::FTP::Recursive rget

by daytripper1021 (Initiate)
on Aug 12, 2008 at 08:02 UTC ( #703838=perlquestion: print w/replies, xml ) Need Help??

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

Hi there.

I'm a newbie to perl and currently trying to convert an existing shell-script I made to perl.

I'm having problems converting the ftp part. The shell-script version is this:

YDAY=`TZ=TAIST+16 date '+%Y%m%d'`

/usr/bin/ftp -n << EOF

user nped nped


lcd /tmp/npdd/output





I tried the Net::FTP::Recursive module but I'm having trouble with the rget command to use wildcards as above.

Here's what I tried doing (but failed, of course):

use Net::FTP::Recursive;

$ftp = Net::FTP::Recursive->new("", Debug => 0);



$ftp->rget( ParseSub => \&yoursub );

# $ftp->rget("evcREC$YDAY.*,/c0re/goldsch/input");


Replies are listed 'Best First'.
Re: Net::FTP::Recursive rget
by jethro (Monsignor) on Aug 12, 2008 at 10:59 UTC

    I think your rget doesn't need a ParseSub parameter, that is an optional parameter to provide your own directory parse function.

    As far as I can see, Net::FTP::Recursive provides no method to only get some files of a directory, it just slurps everything that is in and under the current directory.

    If you don't mind getting everything from that directory instead of only the ones you want, you just call rget without parameter. Otherwise you either have to read the current directory yourself and change to the directories you want or use a different module

Re: Net::FTP::Recursive rget
by dHarry (Abbot) on Aug 12, 2008 at 08:20 UTC

    Have you tried running it with Debug => 1 ? And what is your ParseSub doing?

Re: Net::FTP::Recursive rget
by graq (Curate) on Aug 12, 2008 at 10:58 UTC
    It is difficult to tell from your code whether this is an issue or not, but there is a difference between mget (Multiple GET) and rget (Recursively GET). The former retrieves files in a directory matching a pattern, the latter retrieves all files in a folder and it's sub folders.

    -=( Graq )=-

Re: Net::FTP::Recursive rget
by apl (Monsignor) on Aug 12, 2008 at 10:39 UTC
    Could you show us the code to yoursub?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://703838]
Approved by Erez
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2022-09-30 09:59 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (125 votes). Check out past polls.