learingperl01
MIS
Hello everyone I am not sure why using the -M to check for files modified after a certain time is not working. Regardless of what time I change the < xxx entry to I get files that don't match that time criteria. Can someone please point me in the right direction, or let me know if there is a better way to accomplish this?
Pretty much all I am trying to do is read files in a directory and only process files that are older than xx time (60) minutes in this example.
thanks for the help in advanced.
Pretty much all I am trying to do is read files in a directory and only process files that are older than xx time (60) minutes in this example.
thanks for the help in advanced.
Code:
opendir (DIR, "$DirPath") or die "Cannot open $DirPath $!\n";
my @Files = grep { !/^\.{1,2}$/ } readdir DIR;
close DIR;
foreach my $file (@Files) {
chomp $file;
print $file, "\n";
if ((-M "$file") < .0416) {
do something
} else {
print "No file(s) found that is older than .0416\n";
}
}