osf_ls_files: List files and directories on OSF

View source: R/osf_ls_files.R

osf_ls_filesR Documentation

List files and directories on OSF

Description

List the files and directories in the top-level of an OSF project, component, or directory. Specify a path to list the contents of a particular subdirectory.

Usage

osf_ls_files(
  x,
  path = NULL,
  type = "any",
  pattern = NULL,
  n_max = 10,
  verbose = FALSE
)

Arguments

x

One of the following:

  • An osf_tbl_node with a single project or component.

  • An osf_tbl_file with a single directory.

path

List files within the specified subdirectory path.

type

Filter query by type. Set to "file" to list only files, or "folder"to list only folders

pattern

Character string used to filter for results that contain the substring "pattern" in their name. Note: this is a fixed, case-insensitive search.

n_max

Maximum number of results to return from OSF (default is 10). Set to Inf to return all results.

verbose

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

Value

An osf_tbl_file with one row for each file or directory, ordered by modification time.

See Also

osf_ls_nodes() to generate a list of projects and components.

Examples

## Not run: 
# Retrieve the Psychology Reproducibility Project from OSF
psych_rp <- osf_retrieve_node("ezum7")

# List all files and directories
osf_ls_files(psych_rp)

# ...only the directories
osf_ls_files(psych_rp, type = "folder")

# ...only PDF files
osf_ls_files(psych_rp, type = "file", pattern = "pdf")

# List the contents of the first directory
osf_ls_files(psych_rp, path = "RPP_SI_Figures")

## End(Not run)

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