Recursive Directory Creation

Usage

rdirs(..., path = getwd(), sep = "_", pad.num = TRUE, text.only = FALSE)

Arguments

...
The pieces of the names to put together. rdirs will use R's recylcing rule with different length vectors.
path
A character vector specifying the root directory path.
sep
A character string to separate the terms.
pad.num
logical. If TRUE numbers will be padded with leading zeros (detects numeric strings supplied using the colon(:) operator or combine (c() function.
text.only
logical. If TRUE rdirs does not create the directories, but only returns the names. This allows the names to be passed to new_report and presentation.

Value

Generates recursive sub directories. Invisibly returns the names of the sub-directories.

Description

Allows the user to input pieces of directory names to quickly generate multiple sub-directories with similar names nested in the same directory.

Examples

## fx <- folder(delete_me) ## rdirs(admin, 1:15, c("d", "f", "w"), c(1, 4, 6)) rdirs(admin, 1:15, c("d", "f", "w"), c(1, 4, 6), text.only = TRUE)
[1] "admin_01_d_1" "admin_02_f_4" "admin_03_w_6" "admin_04_d_1" "admin_05_f_4" "admin_06_w_6" "admin_07_d_1" [8] "admin_08_f_4" "admin_09_w_6" "admin_10_d_1" "admin_11_f_4" "admin_12_w_6" "admin_13_d_1" "admin_14_f_4" [15] "admin_15_w_6"
## rdirs(session, 1:12, seq(as.Date("2000/1/1"), by = "month", length.out = 12)) x <- rdirs(admin, 1:15, c("d", "f", "w"), c(1, 4, 6), text.only = TRUE) ## lapply(x, new_report) ## delete(fx)

See also

folder, delete, dir.create