Description Usage Arguments Value
When writing scripts that need to write to the local machine, we often need to create a unique (often temporary) directory.
This function attempts to create a directory of the given name - or "temp" if no name is given - but will avoid overwriting or recreating an already existing directory.
If a directory of the given name exists, it will instead attempt to create a variant of the given name.
1 | safe_folder(target_name = "temp", target_path = ".")
|
target_name |
The folder name the function will try to create. |
target_path |
Where the folder should be created. Defaults to the current working directory ("."). |
The function will return a list with three items.
x$result
will be a boolean. TRUE
on success and FALSE
on
failure.
x$details
will be a character string explaining what occurred.
Probably only interesting on failure.
x$full_path
will be a character string giving the path of the created
folder. Useful for automation where you need to know what folder was
created.
On success, the given folder will also have been created in the target directory.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.