in reply to Re: File Find question
in thread File Find question

thanks but I want the 3 directories and all the subdirectories and all the files under the 3 directories. Sorry I wasnt clear on that earlier. Can you advise how I would do that? Basically what I have currently but just doing the deep searches on files and directories with the 3 I listed.

Replies are listed 'Best First'.
Re^3: File Find question
by Aristotle (Chancellor) on Nov 06, 2002 at 20:22 UTC
    As far as I can tell the second snippet I posted will do what you want. If it doesn't, you haven't been clear enough.

    Makeshifts last the longest.

      Thanks I got it to work this way (and your map function answer works great also) but was hoping I could get it more condensed without using the map function. Just so I can understand it better since I am a beginner. Anyway to combine what I have here to work??
      #!/usr/local/bin/perl use strict; use File::Find; my $dirs = '/web/directory/AA'; my $dirs2 = '/web/directory/BB'; my $dirs3 = '/web/directory/CC' find(\&search, $dirs); find(\&search, $dirs2); find(\&search, $dirs3); sub search { print "$File::Find::name\n"; }
        Yes. find(\&search, $dirs, $dirs2, $dirs3); Which should actually be
        my @dirs = ('/web/directory/AA', '/web/directory/BB', '/web/directory/ +CC',); find(\&search, @dirs);
        Which can be written as my @dirs = map "/web/directory/$_", 'AA', 'BB', 'CC'; Which we can then embed in the function call: find(\&search, map "/web/directory/$_", 'AA', 'BB', 'CC'); :)

        Makeshifts last the longest.