cp
| Function | Copies pages. It can also copy a page and give the copy a new title, or copy a whole page tree with -r. |
| Options | -n, --dry-run — previews copies and reports would-copy / conflict / failed without creating pages. -r / -R / --recursive — copy a page and its descendants. -y / --yes — confirm a recursive copy. --prefix STR — title prefix for a recursive copy (default Copy of ). |
| Limitations | You can’t copy spaces or folders. Cross-space copies are allowed: single-page cp needs no -y, and cp -r needs -y unless -n. 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. A source whose title already exists under the destination (including Title (N)) is skipped and reported. cp -r: one source, at most 200 pages in the tree; DEST may be in another space. cp -r refuses a tree that contains a folder. A destination like /Name that is not an existing space reports “No such space”. |
Use cp to copy pages in the same space or to another space. A bulk copy accepts several argv sources, a glob (* / ?), or find | cp — at most 100 sources. Single-page and multi-page cp do not need -y. To copy a whole page tree, use cp -r (at most 200 pages in the tree; -y is required, or -n to preview).
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.
Copy a page tree (cp -r)
Section titled “Copy a page tree (cp -r)”cp -r SOURCE DEST copies SOURCE and all of its child pages under an existing DEST, using Confluence’s page-hierarchy copy. DEST may be in another space. Attachments, labels, and page restrictions are copied with the pages. Every copied title gets the prefix (Copy of by default, or your --prefix).
- Preview with
cp -r -n SOURCE DEST(shows how many pages would be copied). Run with-yto copy. - One
SOURCEonly. No pipes, no multiple sources, no rename-copy with-r. - Trees larger than 200 pages are refused — copy subtrees separately.
- The copy runs as a Confluence background task. Shell waits for it; if waiting times out, the copy may still finish on the server — check in Confluence.
Examples
Section titled “Examples”$ 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$ cp ./Page "/Other Space/Parent"$ cp -r -n ./Templates/Project ./Projects$ cp -r -y ./Templates/Project ./Projects$ cp -r -y --prefix '2027 ' ./Plans/2026 ./Plans$ cp -r -y ./folder "/Other Space/Archive"Recipe: Copy a page tree.