Skip to contents

Creates path and its parents with fs::dir_create() when the folder does not exist yet. An existing folder is left alone.

Usage

ensure_dir(path)

Arguments

path

Folder to create.

Value

path, invisibly.

Examples

out <- fs::path(tempfile(), "results", "qc")
ensure_dir(out)
fs::dir_exists(out)
#> /tmp/RtmpacoIFD/file1a112331d7b1/results/qc 
#>                                        TRUE 

unlink(fs::path_dir(fs::path_dir(out)), recursive = TRUE)