utime#

Synopsis#

utime $atime, $mtime, @files;
utime undef, undef, @files;    # set to current time

Description#

Sets the access and modification timestamps of one or more files.

Takes an access time, a modification time (both as Unix epoch seconds, or undef for “now”), followed by a list of file paths. Each file’s timestamps are updated via the POSIX utimes(2) call. When Time::HiRes::utime is available, nanosecond precision is used via utimensat(2).

Passing undef for either timestamp sets it to the current time.

Returns the number of files successfully modified.

See also#

stat, lstat