in reply to Skipping directories using File::Find
sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && -f _ && print("$name\n"); }
Update: Thoroughly reading the OP after I was downvoted (sorry!), I found that the OP only wants to skip certain directories.
What I initially wanted to point out is that using the find2perl utility that comes with find2perl spits out nice perl code and can be used to check if the find sub would actually deliver the correct items..
A correct find2perl line for your problem would then be
find2perl . -type d -name "1*" -prune -o -type f -print
, which would spit out:
... sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && -d _ && /^1.*\z/s && ($File::Find::prune = 1) || -f _ && print("$name\n"); }
|
|---|