Skip navigation.
Your source for Perl tips, howto's, faq and tutorials
( categories: )

Use the 'utime' function to change the timestamp of a file.

'utime' needs at least 3 parameters; the first 2 parameters must be the access and modification time respectively (in seconds, as returned by the 'time' function), the rest of the parameters are the files you want to change.


#-- change timestamp to current time
$current = time;
utime $current, $current, "file1.txt", "file2.txt";