in reply to Limiting file:find depth question

Add:

$File::Find::prune = @{$dirs{$_}} > 1;

to the end of the version of dir_names I gave in my answer to your previous question:

sub dir_names { return if ! -d || ! /[IPD]\d{8}$/; push @{$dirs{$_}}, $File::Find::name; $File::Find::prune = @{$dirs{$_}} > 1; }
True laziness is hard work

Replies are listed 'Best First'.
Re^2: Limiting file:find depth question
by RockE (Novice) on Nov 14, 2013 at 05:46 UTC

    Thanks for replying I'll give that a go.

Re^2: Limiting file:find depth question
by RockE (Novice) on Nov 14, 2013 at 06:08 UTC

    I'm not looking for dupes here, just the full path to each item matching the search pattern. I just don't want it to search under anything with the matching pattern because there can be many additional directories there so its just wasting processing time searching for the pattern which doesn't exist lower then the first instance of the required pattern. Hopefully that makes sense :-) The next posters code seems to work quicker than what I first had.