These functions provide a low-level interface to the computer's file system.
dir.exists(paths)
dir.create(path, showWarnings = TRUE, recursive = FALSE, mode = "0777")
Sys.chmod(paths, mode = "0777", use_umask = TRUE)
Sys.umask(mode = NA)
| Parameter | Description |
|---|---|
path |
a character vector containing a single path name. Tilde expansion (see path.expand) is done. |
paths |
character vectors containing file or directory paths. Tilde expansion (see path.expand) is done. |
showWarnings |
logical; should the warnings on failure be shown? |
recursive |
logical. Should elements of the path other than the last be created? If true, like the Unix command mkdir -p. |
mode |
the mode to be used on Unix-alikes: it will be coerced by as.octmode. For Sys.chmod it is recycled along paths. |
use_umask |
logical: should the mode be restricted by the umask setting? |
# NOT RUN {
## Fix up maximal allowed permissions in a file tree
Sys.chmod(list.dirs("."), "777")
f <- list.files(".", all.files = TRUE, full.names = TRUE, recursive = TRUE)
Sys.chmod(f, (file.info(f)$mode | "664"))
# }