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.--preserve {list<string>}: Preserve only the specified attributes (empty list means no attributes preserved) if not specified only mode is preserved possible values: mode, ownership (unix only), timestamps, context, link, links, xattr.--debug: Explain how a file is copied. Implies -v.--all, -a: Copy hidden files if '*' is provided.
Parameters
...rest: Copy SRC file/s to DEST.
Input/output types:
| input | output |
|---|---|
| nothing | nothing |
Examples
Copy myfile to dir_b.
> cp myfile dir_bRecursively copy dir_a to dir_b.
> cp -r dir_a dir_bRecursively copy dir_a to dir_b, and print the feedbacks.
> cp -r -v dir_a dir_bMove many files into a directory.
> cp *.txt dir_aCopy only if source file is newer than target file.
> cp -u myfile newfileCopy file preserving mode and timestamps attributes.
> cp --preserve [ mode timestamps ] myfile newfileCopy file erasing all attributes.
> cp --preserve [] myfile newfileCopy file to a directory three levels above its current location.
> cp myfile ....