Skip to contents

Checks if all directories exist (or if exists = FALSE do not exist as directories or files).

Usage

check_dirs(x, exists = TRUE, x_name = NULL)

Arguments

x

The object to check.

exists

A flag specifying whether the files/directories must (or must not) exist.

x_name

A string of the name of object x or NULL.

Value

An informative error if the test fails or an invisible copy of x.

See also

Examples

check_dirs(tempdir())
try(check_dirs(tempdir(), exists = FALSE))
#> Error in eval(expr, envir, enclos) : 
#>   `tempdir()` must not specify existing directories ('/tmp/RtmpvBqZFZ' exists).