use strict; use File::Find; my $startDir = '/mypathhere'; unless (-d $startDir) { die "Directory '$startDir' is not a Directory.\n"; } find({ preprocess => sub { return grep { not(-d and /dir(?:dirOne|dirTwo|dirThree)/) } @_ }, wanted => \&processSub, }, $startDir); sub processSub { if(-d $_) { print "$File::Find::name\n"; } }