in reply to net ftp recursive - rls and rdir

Thanks guys.

What i'm looking for is this - I have a list of filenames in my hand. I know they are present in the Unix Sever. I have the name of the parent directory - "/home/prod/game/code". the files may be directly present under this, or in any of the multiple subdirectories(which inturn has many directories under) under it. I do not have the names of all the subdirectories.

So I need to run a search in this 'code' direcory I have and FTP only the files in the list to my local.

As of now, I’m only able to retrieve the files we need only after navigating to the correct directory in which it resides(by hard coding the directory name in the code)

The method i tried above looks complicated. Can you please let me know some solution to get only the desired files.

Thank You!

Replies are listed 'Best First'.
Re^2: net ftp recursive - rls and rdir
by Lotus1 (Vicar) on Sep 10, 2012 at 14:23 UTC

    It isn't complicated if you add functionality incrementally. Have you gotten the code you have working with what we gave you so far? That will give you a list of the files in a text file. Then grep that list for the ones you want. Then you just need a function to ftp each file that grep returns.

      Hi Lotus,

      Yes I got the list of files in a text file. but the size of the file is 70 MB. Is there any way we can ignore specific files. I want to ignore .log files while doing rls. Will a OmitAll work?

      And regarding grep, I'm writing this Perl script in a windows system which FTPs files from Unix. So how do i give a grep function into the Perl file. Do I have to use any other package.

      This is a snippet of my output

      /home/prod/test/code

      /

      RxD_CLM_bteq_TEMP_LOAD_V20.sh

      /home/prod/test/code/BABW/logs

      /

      Agent_Totals_CO_Merced_FTP_20110122033155.log

        Hey guys

        got it. All to be done is to use the Matchfile parameter. Just add the filenames u want in an array and execute this :)

        foreach my $i (@array) { $f->rget(MatchFiles => qr/$i/) ; }