in reply to Searching all directories except one

Well no, not like that - Perl can't know what set you want to exclude zz from. You have to read the directory and throw away the entries you don't want.
my $base_dir = '/directory/subdirectory/webstuff'; my %exclude = map { $_ => undef } qw(. .. zz); opendir my($dh), $base_dir; my @dir = grep { not exists $exclude{$_} and -d "$base_dir/$_" } readd +ir $dh; closedir $dh; find( \&findstuff, map "$base_dir/$_", @dir);
Update: Fixed code.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: Searching all directories except one
by UnderMine (Friar) on Nov 18, 2002 at 14:30 UTC
    Do you need to exclude sub-directories from the match or just major trees?

    If you need to exclude the sub-drectories even if the parent is not excluded you may need to be more explicit in your search.

    Just a thought
    UnderMine

      That would be a case for the preprocess predicate to find().

      Makeshifts last the longest.

Re: Re: Searching all directories except one
by Anonymous Monk on Nov 18, 2002 at 15:25 UTC
    I tried as suggested and keep gettin this error:
    Not enough arguments for grep at weba8b.pl line 31, near "} and" Execution of weba8b.pl aborted due to compilation errors.
    Am I missing some sort of "return" statement??
      Sorry, I keep getting tripped by the grep EXPR form. I updated my node; the code that's there now should work.

      Makeshifts last the longest.