$File::Find::prune almost does what you want. It is normally used to tell File::Find to stop descending the directory tree, but it does not stop File::Find from continuing to walk the directory it is already in. To also abort the current directory, just examine $File::Find::prune in the first line of your wanted subroutine, and return if it is set. File::Find will reset $File::Find::prune when it changes to the next directory.
HTH,
Bruce Gray
sub wanted { # Skip the rest of the current directory. return if $File::Find::prune; if (($fileage <= $modtime) && (-d $_)) { #check file age if (($fileage <= $modtime) && (-f $_)){ #..do whatever } } else { # Do not descend further down the tree. $File::Find::prune = 1; # Skip this file. return; } }
In reply to Re: skiping to the next dir using File::Find;
by Util
in thread skiping to the next dir using File::Find;
by costas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |