Hi Monks
Could I seek some help on the following code please?
I'm trying to Stat the pattern matched directory but am coming up with zero. Any help would be appreciated.
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 t +rying 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 patter +n. 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}$/; }
In reply to File::Find stat question by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |