Hello RockE,
As you don’t actually ask a question, I’ll have to guess that you want a way to remove duplicate directories from your output. Here is one approach:
... my %dirs; find(\&dir_names, $wellpath); print "$_\n" for sort keys %dirs; sub dir_names { # skip over everything that is not a directory return unless -d $File::Find::name; # skip over directories that don't match required pattern return unless $File::Find::dir =~ /[IPD]\d{8}$/; $dirs{$File::Find::dir} = 1; }
That is, instead of printing each directory as it is found, store it in a hash and print the hash keys after the call to find has completed. As hash keys are necessarily unique, no duplicates will be recorded.
Hope that helps,
Update: See the correction below.
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: File::Find pattern match question
by Athanasius
in thread File:Find pattern match question
by RockE
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |