Lists all files in a dataset snapshot. Can list the root directory or
drill into subdirectories using the tree parameter.
Arguments
- id
Dataset identifier (e.g., "ds000001").
- tag
Snapshot version tag (e.g., "1.0.0"). If
NULL(default), uses the most recent snapshot.- tree
Subdirectory token for listing nested files. Use the
idcolumn from a previous call to explore subdirectories. DefaultNULLlists the root directory.- client
An
openneuro_clientobject. IfNULL, creates a default client.
Value
A tibble with columns:
- filename
Name of the file or directory
- size
File size in bytes (numeric), may be NA for directories
- directory
TRUE if this entry is a directory (logical)
- annexed
TRUE if file is stored in git-annex (logical). Annexed files are typically larger and require special download handling.
- id
Unique identifier for this entry. Pass it as the
treeargument to explore a subdirectory.- urls
List column of direct HTTPS download URLs for the entry (character vector, empty for directories).
- key
Backward-compatible alias of
id(the directory tree token).
Returns an empty tibble with the same column structure if the snapshot has no files.
Details
OpenNeuro stores datasets using git-annex, where large files are stored
separately from the git repository. The annexed column indicates which
files use this storage method.
To explore a directory structure:
Call
on_files()to get the root listingFilter for
directory == TRUEentriesUse the
idfrom a directory to callon_files(tree = id)
See also
on_snapshots() to list available snapshots
Examples
if (FALSE) { # \dontrun{
# List root files using latest snapshot
files <- on_files("ds000001")
print(files)
# List files in a specific snapshot
files <- on_files("ds000001", tag = "1.0.0")
# Explore a subdirectory
dirs <- files[files$directory, ]
if (nrow(dirs) > 0) {
subfiles <- on_files("ds000001", tree = dirs$id[1])
print(subfiles)
}
# Find all annexed (large) files
annexed_files <- files[files$annexed & !files$directory, ]
} # }