in reply to Pruning directory searches with File::Find

I don't think that File::Find is going to let you throw away directory subtrees that you don't like. You could put code into your wanted() method that will ignore files with a path of the form that you describe, but you're going (to the best of my understanding) end up having File::Find waste time by walking through whole subtrees that you'd rather ignore. You might try using the following idiom in the place of File::Find to accomplish what you want...

use strict; use Cwd; my $cwd = Cwd::getcwd(); my $directory = shift(@ARGV) || $cwd; $directory = $cwd . '/' . $directory unless $directory =~ /^\//; my @queue = ($directory); while (@queue) { my $node = shift(@queue); if (-d $node) { opendir(DIR, $node); push(@queue, map { $node . '/' . $_ } grep { $_ ne '.' and $_ ne '..' and $_ !~ /^_/ } readdir(DIR)); closedir(DIR); } else { do_your_stuff($node); } }

This will do a depth first search on either the current working directory, or the directory that you specify on the command line, and it will ignore all subtrees of directories beginning with _. I hope this helps, and I hope it doesn't turn out to be a horribly convoluted way of doing it if there is an easier way with File::Find.

Update: It was come to my attention that exploitation of the $File::Find::prune variable is a much more expeditious way of accomplishing a pruning. I confess! I confess! Now stop minus one-ing me, I admit the error of my ways.