in reply to How do I recurse all *but* a few directories?

I think it depends on whether your 'few' directories are full pathnames or all '.CVS' directories as above. Or some other requirement we don't know about.

Here's something that includes the first two:

use File::Find; my @abs_dirs=qw(/dont/go/here /stay/out); my @all_dirs=qw(.CVS .stayout); my %abs_dirs; @abs_dirs{@abs_dirs}=(); my %all_dirs; @all_dirs{@all_dirs}=() find (sub { $File::Find::prune=1, return if -d and (exists $abs_dirs{$File::Find: +:name} or exists $all_dirs{$_}); # Process other files, dirs # }, ".");

Update: runrigs fix (see below) was incorporated

Replies are listed 'Best First'.
RE: Answer: How do I recurse all *but* a few directories?
by runrig (Abbot) on Sep 17, 2000 at 20:01 UTC
    '$File::Find::dir' above should be '$File::Find::name', since '...dir' gives you the directory above the current directory '$_'.

    Too bad we don't get to edit Answers :(