use File::Find;
find(\&wanted, 'dir1', 'dir2'...);
sub wanted { ... }
use File::Find;
finddepth(\&wanted, 'dir1', 'dir2'...); # traverse depth-first
sub wanted { ... }
*****
sub wanted {
print "$File::Find::name\n" if -x;
}
*****
find2perl / -name .nfs\* -mtime +7 \
-exec rm -f {} \; -o -fstype nfs -prune
*****
sub wanted {
/^\.nfs.*$/ &&
(($dev, $ino, $mode, $nlink, $uid, $gid) = lstat($_)) &&
int(-M _) > 7 &&
unlink($_)
||
($nlink || (($dev, $ino, $mode, $nlink, $uid, $gid) = lstat($_))) &&
$dev <0 && ($file::find::prune=1); } ***** sub wanted { -l and not -e and print "bogus link: $File::Find::name\n" ; }>