in reply to Re^2: File::Find wanted and preprocess together
in thread File::Find wanted and preprocess together

You don't use "bydepth" option. Which means that you can cancel processing of any subdirectory by setting $File::Find::prune=1. So, in your "wanted" function check if the file should be excluded from the processing and then set $File::Find::prune for the directories that should be excluded and simply ignore the files that should be excluded. Something like

sub my_wanted{ if(exists $skip_them{$_}) { $File::Find::Prune = 1 if -d $_; return; } do_process($_); }

Replies are listed 'Best First'.
Re^4: File::Find wanted and preprocess together
by justinjoseph24 (Initiate) on Nov 09, 2010 at 19:54 UTC
    Thanks for your reply, Andal. I added this logic to my script and it works. It's a great substitute for the 'preprocess' option. Now I can use follow => 1 and still process exclusions efficiently.