file_test {utils} | R Documentation |
Utility for shell-style file tests.
file_test(op, x, y)
op |
a character string specifying the test to be performed.
Unary tests (only |
x,y |
character vectors giving file paths. |
‘Existence’ here means being on the file system and accessible
by the stat
system call (or a 64-bit extension) – on a
Unix-alike this requires execute permission on all of the directories in
the path that leads to the file, but no permissions on the file
itself.
For the meaning of "-x"
on Windows see file.access
.
file.exists
which only tests for existence
(test -e
on some systems) but not for not being a directory.
dir <- file.path(R.home(), "library", "stats") file_test("-d", dir) file_test("-nt", file.path(dir, "R"), file.path(dir, "demo"))