ok tried your example and it doesn't print anything out, if I remove the pattern matching requirement it does work but obviously shows me all directories
#!/usr/bin/perl # dirpath 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\\'; our $testpath = 'C:\\Temp\\'; #******************************************************* my %dirs; find(\&dir_names, $testpath); 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; }
In reply to Re^2: File:Find pattern match question
by RockE
in thread File:Find pattern match question
by RockE
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |