pathological (version 0.1-1)

create_dirs: Create or remove files and directories

Description

A vectorized version of dir.create, and file.create and unlink with more convenient defaults.

Usage

create_dirs(x = temp_file(pattern = "dir"))
create_files(x = temp_file())
remove_dirs(x)

Arguments

x
A character vector of paths of directories to create/remove. For create_dirs, it defaults to a directory inside tempdir().

Value

A logical vector of successes of failures.

See Also

dir.create, unlink

Examples

Run this code

dirs <- temp_dir(c("foo", "bar/baz"))
create_dirs(dirs)

# Check this worked:
assertive.files::assert_all_are_dirs(dirs)

files <- temp_dir("blah/blah/blah", LETTERS)
create_files(files)

assertive.files::assert_all_are_existing_files(files)

# Clean up
remove_dirs(temp_dir(c("foo", "bar", "blah")))

Run the code above in your browser using DataLab