Product Site

8.52. SysSetFileDateTime

Sets the last-modified timestamp of a file.

If both newdate and newtime are omitted, the last-modified timestamp is set to the current date and time, similar to what the touch command on Unix-like systems does.

If only one of the newdate and newtime arguments is supplied, the respective other last-modified date/time portion stays unchanged.

Parameters
filename

The name of a file or directory for which the last-modified timestamp should be updated. The name does not support wildcard characters. On Unix-like systems, if the first character is a ~ (tilde) character optionally followed by a username, it is replaced by the current or specified user's home directory.
newdate

An optional new date in the format yyyy-mm-dd. On Windows yyyy must be greater than or equal to 1800.
newtime

An optional new time in the format hh:mm:ss (24-hour format).

Return codes
0

The file date and/or time were updated successfully.
-1

The timestamp update failed.

See also File methods lastModified (Attribute) and lastModified (Attribute), and Rexxutil SysGetFileDateTime.
Example 8.38. RexxUtil — SysSetFileDateTime
call SysSetFileDateTime "."                       -- touch current directory
call SysSetFileDateTime "main.c", , "05:00:00"    -- change file time only