in reply to ftp'ing 'Find' results from an array

I want to ftp from a machine into another machine, do a find,ftp all the files, not the directories

do you mean getting or putting them by "ftp" them?

and further:

$> perldoc Net::FTP /find
returns pattern not found (press RETURN) there is no ftp-connection-oriented part in your find(...) statement. perldoc File::Find contains no ftp-related information.

I'm just curious, really no pun intended, after reading the docs, why did you think this should work?

If the file-count on the ftp-server side isn't to large, your recursive ls approach should work ok, because you can perform the find in your perl-script, it is kind of brute force, though.

maybe if you comment a bit on why you want to do that, the monastery may come up with a feasible solution


regards,
tomte

Replies are listed 'Best First'.
Re: Re: ftp'ing 'Find' results from an array
by ortsac (Initiate) on Aug 13, 2002 at 18:30 UTC
    Thanks for your notes. I have also tried
    @data=$ftp->ls("-R"); foreach $line (@data) { $ftp->get($line); print $line."\n"; }
    But it doesn't work because it stops at the . or .. directories. The 'get' line chokes there. My 'Find' question obviously won't work as it only returns me the local files. I am just out of tricks on this one. In short, what I am trying to do, is: FTP there cd to a dir. get all the files there and below. close connection. seems simple.

      You could try somthing like this (untested!)

      @data=$ftp->ls("-R"); foreach $line (@data) { if !($line =~ m/^\.{1,2}/){ print "fetching " . $line . "\n"; $ftp->get($line) ; } }

      It sounds though as if wget or rsync could be useful in your case ( I don't know if there are modules out there providing the same functionality). you can call both tools via system, if the ftp-get part is just a fraction of the big picture of your project.

      Update: changed punctuation to clarify the meaning


      regards,
      tomte