.TH "datalad copy-file" "1" "2021\-02\-04" "datalad copy-file 0.14.0" .SH NAME \fBdatalad copy-file\fR \- copy files and their availability metadata from one dataset to another. .SH SYNOPSIS .nh .HP \fBdatalad copy\-file\fR [-h] [-d\~DATASET] [--recursive] [--target-dir\~DIRECTORY] [--specs-from\~SOURCE] [-m\~MESSAGE] [PATH ...] .hy .SH DESCRIPTION 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. .PP .TP NOTE At the moment, only URLs for the special remotes 'web' (git\-annex built\-in) and 'datalad' are recognized and transferred. .PP 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. .PP 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. .PP .SS Examples .PP Copy a file into a dataset 'myds' using a path and a target directory specification, and save its addition to 'myds':: .PP % datalad copy\-file path/to/myfile \-d path/to/myds .PP Copy a file to a dataset 'myds' and save it under a new name by providing two paths:: .PP % datalad copy\-file path/to/myfile path/to/myds/new \-d path/to/myds .PP Copy a file into a dataset without saving it:: .PP % datalad copy\-file path/to/myfile \-t path/to/myds .PP Copy a directory and its subdirectories into a dataset 'myds' and save the addition in 'myds':: .PP % datalad copy\-file path/to/dir \-r \-d path/to/myds .PP Copy files using a path and optionally target specification from a file:: .PP % datalad copy\-file \-d path/to/myds \-\-specs\-from specfile .PP Read a specification from stdin and pipe the output of a find command into the copy\-file command:: .PP % find | datalad copy\-file \-d path/to/myds \-\-specs\-from \- .SH OPTIONS .TP PATH paths to copy (and possibly a target path to copy to). Constraints: value must be a string .TP \fB-h\fR, \fB--help\fR, \fB--help-np\fR show this help message. --help-np forcefully disables the use of a pager for displaying the help message .TP \fB-d\fR \fI\s-1DATASET\s0\fR, \fB--dataset\fR \fI\s-1DATASET\s0\fR root dataset to save after copy operations are completed. All destination paths must be within this dataset, or its subdatasets. If no dataset is given, dataset modifications will be left unsaved. Constraints: Value must be a Dataset or a valid identifier of a Dataset (e.g. a path) .TP \fB--recursive\fR, \fB-r\fR copy directories recursively. .TP \fB--target-dir\fR DIRECTORY, \fB-t\fR DIRECTORY copy all source files into this DIRECTORY. This value is overridden by any explicit destination path provided via --specs-from. When not given, this defaults to the path of the dataset specified via --dataset. Constraints: value must be a string .TP \fB--specs-from\fR SOURCE read list of source (and destination) path names from a given file, or stdin (with '-'). Each line defines either a source path, or a source/destination path pair (separated by a null byte character). .TP \fB-m\fR MESSAGE, \fB--message\fR MESSAGE a description of the state or the changes made to a dataset. Constraints: value must be a string .SH AUTHORS datalad is developed by The DataLad Team and Contributors .