datalad copy-file(1) | General Commands Manual | datalad copy-file(1) |
datalad copy-file - copy files and their availability metadata from one dataset to another.
datalad copy-file [-h] [-d DATASET] [--recursive] [--target-dir DIRECTORY] [--specs-from SOURCE] [-m MESSAGE] [PATH ...]
The difference to a system copy command is that here additional content availability information, such as registered URLs, is also copied to the target dataset. Moreover, potentially required git-annex special remote configurations are detected in a source dataset and are applied to a target dataset in an analogous fashion. It is possible to copy a file for which no content is available locally, by just copying the required metadata on content identity and availability.
The interface is modeled after the POSIX 'cp' command, but with one additional way to specify what to copy where: --specs-from allows the caller to flexibly input source-destination path pairs.
This command can copy files out of and into a hierarchy of nested datasets. Unlike with other DataLad command, the --recursive switch does not enable recursion into subdatasets, but is analogous to the POSIX 'cp' command switch and enables subdirectory recursion, regardless of dataset boundaries. It is not necessary to enable recursion in order to save changes made to nested target subdatasets.
Copy a file into a dataset 'myds' using a path and a target directory specification, and save its addition to 'myds'::
% datalad copy-file path/to/myfile -d path/to/myds
Copy a file to a dataset 'myds' and save it under a new name by providing two paths::
% datalad copy-file path/to/myfile path/to/myds/new -d path/to/myds
Copy a file into a dataset without saving it::
% datalad copy-file path/to/myfile -t path/to/myds
Copy a directory and its subdirectories into a dataset 'myds' and save the addition in 'myds'::
% datalad copy-file path/to/dir -r -d path/to/myds
Copy files using a path and optionally target specification from a file::
% datalad copy-file -d path/to/myds --specs-from specfile
Read a specification from stdin and pipe the output of a find command into the copy-file command::
% find <expr> | datalad copy-file -d path/to/myds --specs-from -
datalad is developed by The DataLad Team and Contributors <team@datalad.org>.
2021-02-04 | datalad copy-file 0.14.0 |