find(\&all, @allpaths); #Open a file called Paths.bak open (LIST, ">$tempfilepath/Paths.bak") or die "$! error trying to overwrite"; #Foreach line (path found) $p in the array @allpathlisting foreach my $p (@allpathlisting) { print LIST "$p\n"; foreach my $s (@sfiles) { print LIST " $s\n"; } } close LIST; copy $tempallpathsoldfile, $tempallpathsnewfile or die "$! error trying to copyfile"; #Sub routine for File::Find. on all locations sub all { #Unless directory skip. return unless -d; # Don't recurse past folders matching the pattern. $File::Find::prune = 1 if /[IPDLMY]\d{8}$/; #Replace / with \ (my $fn = $File::Find::name) =~ tr#/#\\#; #Replace gpfs_data with nas\rdds $fn =~ s/gpfs_data/nas\\rdds/; #Push into the @allpathlisting array any paths matching the pattern. push @allpathlisting, $fn if /[IPDLMY]\d{8}$/; # How big is it? my $fsize = (stat($fn))[7]; push @sfiles,$fsize; print "$fsize\n"; #print results to the screen, comment this out in production. print "$fn\n" if /[IPDLMY]\d{8}$/; }