Copy a Confluence page tree (and copy pages to another space)
Reuse a project template or duplicate a whole section in one command. cp -r copies a page and all of its descendants under another page. DEST may be in the same space or in another space. Preview with -n. Running the copy requires -y even in the same space (omit -y only for -n).
1. Look at the tree
Section titled “1. Look at the tree”$ tree ./Templates/Project -L 32. Preview, then copy
Section titled “2. Preview, then copy”$ cp -r -n ./Templates/Project ./Projects$ cp -r -y ./Templates/Project ./Projects$ cp -r -y ./Templates/Project "/Other Space/Projects"The preview shows how many pages would be copied. -y starts the copy. The destination (./Projects) must already exist.
3. Choose the title prefix
Section titled “3. Choose the title prefix”Every copied page gets a prefix so titles don’t clash. The default is Copy of . Set your own:
$ cp -r -y --prefix 'Client B - ' ./Templates/Project ./ProjectsWhat is copied
Section titled “What is copied”Shell uses Confluence’s page-hierarchy copy: pages, attachments, labels, and page restrictions are copied.
Limits
Section titled “Limits”- One source per run.
DESTmay be in another space;-yis required unless-n. - At most 200 pages in the source tree — copy large trees subtree by subtree.
- No pipes and no multiple sources with
-r. - Folders and spaces can’t be copied.
- The copy runs as a Confluence background task. If Shell stops waiting, the copy may still finish — check in Confluence.
To copy a few individual pages (not a tree), use plain cp — a bulk copy of up to 100 sources, with globs or find … | cp DEST.