See ?Sys.setFileTime
In this case, Sys.setFileTime(path_to_file_or_directory, Sys.time()) will apparently do its job:
In Unix-like, it uses the "if it is available, otherwise" system call. In the POSIX file system, it sets both the last access and modification time.
On Windows, it uses the SetFileTime system call to set the last recording time. Some Windows file systems only record a resolution time of two seconds.
Although I'm not sure how to match "it uses a system call", if available, otherwise "utimes" with any meaningful expression.
source share