You need to retrieve or alter when a file was last modified (written or changed) or accessed (read).
($READTIME, $WRITETIME) = (stat($filename))[8,9]; utime($NEWREADTIME, $NEWWRITETIME, $filename);
As explained in the Introduction, three different times are associated with an inode in the traditional Unix filesystem. Of these, any user can set the
$SECONDS_PER_DAY = 60 * 60 * 24; ($atime, $mtime) = (stat($file))[8,9]; $atime -= 7 * $SECONDS_PER_DAY; $mtime -= 7 * $SECONDS_PER_DAY; utime($atime, $mtime, $file) or die "couldn't backdate $file by a week w/ utime: $!";
You must call
$mtime = (stat $file); utime(time, $mtime, $file);
This is easier to understand if you use File::stat:
use File::stat; utime(time, stat($file)->mtime, $file);
Copyright © 2002 O'Reilly & Associates. All rights reserved.