tree.create: Create a Directory Tree

Description Usage Arguments Value Examples

Description

Creates a tree of directories with flexible structure by running dirs.create over paths defined by the generalized tree input list, which is processed through tree_paths.

Usage

1
2
3
4
5
6
7
8
9
tree.create(
  tree = list(),
  fsep = .Platform$file.sep,
  winslash = "\\",
  mustWork = NA,
  showWarnings = TRUE,
  recursive = TRUE,
  mode = "0777"
)

Arguments

tree

list object describing a directory tree hierarchicaly as ingested by tree_paths. See Examples.

fsep

Path separator to use (assumed to be ASCII). See file.path.

winslash

Separator to be used on Windows - ignored elsewhere. See normalizePath.

mustWork

logical: if TRUE then an error is given if the result cannot be determined; if NA, then a warning. See normalizePath.

NB: The default argument is changed to FALSE compared to NA, given that the folders are being created and so are by default, assumed to not yet exist. The argument is retained, however, as it can be useful for avoiding overwriting of existing folders.

showWarnings

logical: should the warnings on failure be shown? See dir.create.

recursive

logical: should elements of the path other than the last be created? If TRUE, like the Unix command mkdir -p.

NB: The default argument is changed to TRUE compared to dir.create and dirs.create in order to create the full tree. Setting recursive = FALSE will generate a "tree" with only its final (branch tip) folders created.

mode

The mode to be used on Unix-alikes: it will be coerced by as.octmode. For Sys.chmod it is recycled along paths. See dir.create.

Value

logical vector of results of dir.create on each of the paths (which name the vector). See dir.create.

Examples

1
2
3
4
5
6
 ## Not run: 

   1
 
  
## End(Not run)

weecology/directree documentation built on Dec. 23, 2021, 5:09 p.m.