osf_mkdir: Create directories on OSF

View source: R/osf_mkdir.R

osf_mkdirR Documentation

Create directories on OSF

Description

Use osf_mkdir() to add new directories to projects, components, or nested within existing OSF directories. If path contains multiple directory levels (e.g., "data/rawdata") the intermediate-level directories are created automatically. If the directory you're attempting to create already exists on OSF it will be silently ignored and included in the output.

Usage

osf_mkdir(x, path, verbose = FALSE)

Arguments

x

One of the following:

  • An osf_tbl_node with a single OSF project or component.

  • An osf_tbl_file containing a single directory.

path

Name of the new directory or a path ending with the new directory.

verbose

Logical, indicating whether to print informative messages about interactions with the OSF API (default FALSE).

Value

An osf_tbl_file with one row containing the leaf directory specified in path.

See Also

Other OSF file operations: osf_cp(), osf_mv(), osf_rm()

Examples

## Not run: 
proj <- osf_create_project("Directory Example")

# add directory to the top-level of the Directory Example project
data_dir <- osf_mkdir(proj, path = "data")

# add a subdirectory nested within data/
osf_mkdir(data_dir, path = "rawdata")

# recursively create multiple directory levels within data/
osf_mkdir(data_dir, path = "samples/pcr/qc")

## End(Not run)

CenterForOpenScience/osfr documentation built on Oct. 3, 2022, 4:29 a.m.