dir.create {file} R Documentation

dir.create creates the last element of the path, unless recursive = TRUE.

Description

Trailing path separators are discarded. On Windows drives are allowed in
the path specification and unless the path is rooted, it will be interpreted
relative to the current directory on that drive. mode is ignored on Windows.

One of the idiosyncrasies of Windows Is that directory creation may report
success but create a directory with a different name, for example dir.create("G.S.")
creates '"G.S"’. This is undocumented, and what are the precise circumstances
is unknown (and might depend on the version of Windows). Also avoid directory
names with a trailing space.

Usage

dir.create(path,
    showWarnings = TRUE,
    recursive = FALSE,
    mode = "0777");

Arguments

path

a character vector containing a single path name. [as string]

showWarnings

logical; should the warnings on failure be shown?. [as boolean]

recursive

logical. Should elements of the path other than the last be created? If true, Like the Unix command mkdir -p. [as boolean]

mode

the mode To be used On Unix-alikes: it will be coerced by as.octmode. For Sys.chmod it Is recycled along paths. [as string]

Details

There is no guarantee that these functions will handle Windows relative paths of the form ‘d:path’: try ‘d:./path’ instead. In particular, ‘d:’ is not recognized as a directory. Nor are \\?\ prefixes (and similar) supported. UTF-8-encoded dirnames Not valid in the current locale can be used.

Authors

SMRUCC genomics Institute

Value

dir.create and Sys.chmod return invisibly a logical vector indicating if the operation succeeded for each of the files attempted. Using a missing value for a path name will always be regarded as a failure. dir.create indicates failure if the directory already exists. If showWarnings = TRUE, dir.create will give a warning for an unexpected failure (e.g., not for a missing value nor for an already existing component for recursive = TRUE).

clr value class

Examples


[Package file version 2.33.856.6961 Index]