cp
for filesystem
Copy files using uutils/coreutils cp.
Signature
> cp {flags} ...rest
Flags
-
--recursive, -r
: copy directories recursively -
--verbose, -v
: explicitly state what is being done -
--force, -f
: if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used). currently not implemented for windows -
--interactive, -i
: ask before overwriting files -
--update, -u
: copy only when the SOURCE file is newer than the destination file or when the destination file is missing --progress, -p
: display a progress bar-
--no-clobber, -n
: do not overwrite an existing file -
--debug, -
: explain how a file is copied. Implies -v
Parameters
...rest
: Copy SRC file/s to DEST
Input/output types:
input | output |
---|---|
nothing | nothing |
Examples
Copy myfile to dir_b
> cp myfile dir_b
Recursively copy dir_a to dir_b
> cp -r dir_a dir_b
Recursively copy dir_a to dir_b, and print the feedbacks
> cp -r -v dir_a dir_b
Move many files into a directory
> cp *.txt dir_a
Copy only if source file is newer than target file
> cp -u a b