I think you are missing something on your end.
I created a directory, relative to this script:
I create the directory find_tmp and three directories inside of it -- each one contained two touched files, foo and bar. I set the permissions of one of those directories to 000 and ran the script:use strict; use warnings; use File::Find; &find(\&wanted, 'find_tmp'); sub wanted { /^foo$/ && print("$_\n"); }
[jeffa@server1 perl]$ ./foo.pl foo Can't cd to (find_tmp/) cannot: Permission denied at ./foo.pl line 9 fooLooks like File::Find is indeed skipping directories as advertised -- that is, it is not die'ing when it cannot access them due to permissions. (Are you really sure you have the proper permissions?) If you redirect STDERR, you won't get the warning messages:
[jeffa@server1 perl]$ ./foo.pl 2>/dev/null foo foo
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Skipping unreadable directories with File::Find (or how to test your code)
by jeffa
in thread Skipping unreadable directories with File::Find
by opensourcer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |