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"; }