I have a file /tmp/log/startOnline.was_20050801_0701.joblog which has a timestamp of Aug 01 2005. The last time it was accessed and modified was like over 370 days. Of course, the /tmp/log directory has many log files.
In Perl, here is part of the code:
$path = "/tmp/log"; $file = "startOnline.was_*_*.joblog"; @TODELETE = `ls -t $path/$file`; foreach $logfile (@TODELETE) { printf ("%12s %5d %5d %5d\n", $logfile, -M $logfile, -A $logfile, -C + $logfile); }
The output lists "/tmp/log/startOnline.was_DATE_TIME.joblog 0 0 0".
In Perl, I thought the "-M" file-test operator returns how long since the file has been modified, "-A" returns how long since the file has been accessed, and "-C" returns how long since the file's inode has been accessed.
If $logfile has the full path of the filename, how come the file-test operators display zeroes?
If I can get the file operators to work, I can finish my Perl script to start deleting the older log files.
Any help would be appreciated.
Gary
In reply to Perl File-Test Operators by gyasuda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |