file_test {utils}R Documentation

Shell-style Tests on Files

Description

Utility for testing files.

Usage

file_test(op, x, y)

Arguments

op a character string specifying the test to be performed. Unary tests (only x is used) are "-f" (existence and not being a directory) and "-d" (existence and directory); binary tests are "-nt" (newer than, using the modification dates) and "-ot".
x,y character vectors giving file paths.

Details

file_test performs shell-style file tests.

Note that file.exists only tests for existence (test -e on some systems) but not for not being a directory.

See Also

file.path, file.info

Examples

dir <- file.path(R.home(), "library", "stats")
file_test("-d", dir)
file_test("-nt", file.path(dir, "R"), file.path(dir, "demo"))

[Package utils version 2.5.0 Index]