R.utils (version 2.5.0)

mkdirs: Creates a directory including any necessary but nonexistent parent directories

Description

Creates a directory including any necessary but nonexistent parent directories.

Usage

"mkdirs"(pathname, mustWork=FALSE, maxTries=5L, ...)

Arguments

pathname
A character string of the pathname to be checked.
mustWork
If TRUE and the directory does not already exists or is failed to be created, an error is thrown, otherwise not.
maxTries
A positive integer specifying how many times the method should try to create a missing directory before giving up.
...
Not used.

Value

Returns TRUE if the directory was succesfully created, otherwise FALSE. Note that if the directory already exists, FALSE is returned.

Slow file systems

On very rare occassions, we have observed on a large shared file system that if one tests for the existence of a directory immediately after creating it with dir.create(), it may appear not to be created. We believe this is due to the fact that there is a short delay between creating a directory and that information being fully propagated on the file system. To minimize the risk for such false assertions on "slow" file systems, this method tries to create a missing directory multiple times (argument maxTries) (while waiting a short period of time between each round) before giving up.

See Also

Internally dir.create() is used.