# Note that this is also just a quick scribble and you may need to adapt this to your needs # Folders dir /b /s /a:d | perl -ne "print $_ if $_=~/^c:\\myinputpath\\.*?\\myfolder\\.*?$/" > filesconfig.txt # Files dir /b /s | perl -ne "print $_ if $_=~/^c:\\myinputpath\\.*?\\myfolder\\filenames.*?$/" > foldersconfig.txt #### 'inputdir=s' => \$inputdir, -> 'configfile=s' => \$configfile, #### open( my $cfg, "<", $configfile ) or die "Can't open < $configfile: $!" ; my @files = () ; while( my $f = <$cfg>) { chomp $f ; # print "f=$f\n" ; opendir(my $dh, $f) or die "ERR: Can't open directory $f: $!"; push @files, map { "$f\\$_" } grep { -f "$f\\$_" } readdir($dh); closedir($dh) ; } foreach ( @files ) { print "$_\n" ; }