(/opt/backups/maindb[0-9]+.db/table[0-9]+.tn/chunk[0-9]+.cn/) #### #!/usr/bin/perl -w use strict; my $regexStr = qr{[0-9]+}; my $suff = ".dn"; listThisFolder($regexStr); sub listThisFolder { my ($regexStr) = @_; my $getDir = ("c:\\sh\\"); # I know that the folder exists, but I don't know what the table # suffix or chunk suffix would be (table-129.tn or table-001.tn, etc). # $ls would hold the contents of the folder which expanded from the regex my $ls = `dir $getDir$regexStr$suff`; print "$ls\n"; #return($ls); }