Skip to content

cp

FunctionCopies pages. It can also copy a page and give the copy a new title.
Options-n, --dry-run — previews copies and reports would-copy / conflict / failed without creating pages.
LimitationsSame space only. You can’t copy spaces. Glob * / ? on the last segment of each source argv path only (not DEST; not piped stdin). Zero matches is an error. At most 100 sources. If a source fails, Shell keeps the successful copies. Live copies skip a source when the destination already has that title.

With two paths, an existing destination becomes the copy’s parent. If the destination doesn’t exist and contains no /, Shell creates a sibling page with that title.

To copy multiple pages under an existing destination, use cp src1 src2 … destination.

With a pipe, stdin is a list of source paths (one per line). The only command-line path argument is DEST. Argv sources are not merged with stdin.

Flags may appear anywhere among the arguments.

$ cp ./pageA ./folder
$ cp OldName NewName
$ cp pageA pageB ./folder
$ cp Draft* ./folder
$ cp --dry-run pageA pageB ./folder
$ find ./folder -name 'Draft*' | cp -n ./Archive
$ find ./folder -name 'Draft*' | cp ./Archive