Sys.setFileTime {base} | R Documentation

## Set File Time

### Description

Uses system calls to set the times on a file or directory.

### Usage

    Sys.setFileTime(path, time)

### Arguments

`path` | A length-one character vector specifying the path to a file or directory.
`time` | A date-time of class `"POSIXct"` or an object which can be coerced to one. Fractions of a second may be ignored.

### Details

This attempts sets the file time to the value specified.

On a Unix-alike it uses the system call `utimensat` if that is available, otherwise `utimes` or `utime`. On a POSIX file system it sets both the last-access and modification times. Fractional seconds will set as from R 3.4.0 on OSes with the requisite system calls and suitable filesystems.

On Windows it uses the system call `SetFileTime` to set the ‘last write time’. Some Windows file systems only record the time at a resolution of two seconds.

### Value

Logical, invisibly. An indication if the operation succeeded.

[Package base version 3.4.3 Index]