I am trying to write some code to read the most recent log file in a
directory. I wrote some code below. This works but I was wondering if
there was a more efficient method to do this. Ideally I would like to
include hours, minutes and seconds but that's not necessary at this
point.
--Paul
foreach $iislog (@files) {
($WRITETIME) = (stat("$iislogs\\$iislog"))[9];
print scalar localtime ($WRITETIME);
($seconds, $minutes, $hours, $day, $month, $year, $wday, $yday,
$isdst) = localtime();
($seconds2, $minutes2, $hours2, $day2, $month2, $year2, $wday2,
$yday2, $isdst2) = localtime($WRITETIME);
if ($day == $day2 && $month == $month2) {
#print scalar localtime();
print "\n\n";
print "The file was last modified on: ";
print scalar localtime ($WRITETIME);
print "\n\n";
}
}