Description Usage Arguments Value Author(s) References See Also Examples
See ensureDirectory
.
1 2 | ## S4 method for signature 'DirectoryPath.S3'
ensureDirectory(path, strict, ...)
|
path |
|
strict |
|
... |
Further arguments to be passed to:
|
logical
vector. TRUE
for success, FALSE
for failure.
Janko Thyson janko.thyson@rappster.de
https://github.com/Rappster/filesystr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ## Not run:
## Auxiliary functions //
.carefulCleanup <- function(x, pattern=basename(tempdir())) {
out <- sapply(x, function(ii) {
out <- NA
if (grepl(pattern, ii)) {
out <- unlink(ii, recursive=TRUE, force=TRUE)
}
out
})
invisible(out)
}
## Example content //
path <- file.path(tempdir(), "ensureDirectory")
sapply(path, dir.create, recursive=TRUE, showWarnings=FALSE)
path <- file.path(path, letters[1:3])
ensureDirectory(path = path)
## If directory already exists //
ensureDirectory(path = path)
## Clean up //
.carefulCleanup(x = path)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.