Unlike the touch POSIX utility this does not create the file if it does not
exist. Use file_create() to do this if needed.
file_touch(path, access_time = Sys.time(), modification_time = access_time)
| path | A character vector of one or more paths. |
|---|---|
| access_time, modification_time | The times to set, inputs will be coerced to POSIXct objects. |
.old_wd <- setwd(tempdir()) file_create("foo") file_touch("foo", "2018-01-01") file_info("foo")[c("access_time", "modification_time", "change_time", "birth_time")]#> access_time modification_time change_time birth_time #> 1 2018-01-01 2018-01-01 2020-04-23 15:18:10 2020-04-23 15:18:10setwd(.old_wd)