Hi Monks I have this script that looks for specific directories. However it reports the pattern matched directory and then lists the same directory name again depending on how many sub directories there are. How do I fix the code to only list the directory once.
use strict; use warnings; use File::Find; use Fcntl; #*****************Path Variables******************* our $wellpath = 'N:\\repos\\open\\Wells\\Regulated'; our $surveypath = 'N:\\repos\\open\\Surveys\\Regulated'; #************************************************** find(\&dir_names, $wellpath); sub dir_names { # skip over everything that is not a directory return '' if ! -d $File::Find::name; # skip over directories that don't match required pattern return if (not $File::Find::dir =~ qr{([IPD]\d{8}$)}); print "$File::Find::dir\n"; }
It displays this 3 times because there are 3 sub directories below it P00436188
Regulated/AC/Abalone_1_ENO5655/Logs_digital/P00436188
Regulated/AC/Abalone_1_ENO5655/Logs_digital/P00436188 /p>Regulated/AC/Abalone_1_ENO5655/Logs_digital/P00436188
Thanks for all the replies
In reply to File:Find pattern match question by RockE
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |