in reply to Re: File::Find pattern match question
in thread File:Find pattern match question
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: File::Find pattern match question
by Athanasius (Cardinal) on Nov 01, 2013 at 02:22 UTC | |
by RockE (Novice) on Nov 02, 2013 at 12:06 UTC |