How do I move or copy Confluence pages from a command line?
Shell for Confluence is a free Confluence CLI console (bash-like) for managing Confluence content. It maps your site to a filesystem: / is the site root, followed by spaces and their pages.
When the console opens, welcome tips suggest trying tree, find -mtime, ls --format csv, find -label, and find -mtime +730 -prune | archive -n, plus the line “Cross-space mv / cp — mv needs -y.” Current Cloud version: 3.11.0.
Can I move several pages at once?
Section titled “Can I move several pages at once?”Yes. Add multiple source pages to one mv command:
$ mv pageA pageB pageC destParentSources may be in one space or several, and DEST may be in another space — a cross-space move (including a mixed batch) needs -y / --yes. You can pass several named sources, use * or ? in the last segment of each source path on the command line (not on DEST; not from piped stdin), or pipe from find:
$ mv Draft* ./Archive$ find . -name '*2023*' | mv -n ./Archive$ find . -name '*2023*' | mv ./ArchiveAt most 100 sources. Zero glob matches is an error. If one source fails, Shell keeps the successful moves. There is no Bulk multi-select panel — use globs, multiple argv sources, or find | mv.
Can I search for pages and then move them?
Section titled “Can I search for pages and then move them?”Yes. Find or filter pages, then move or copy the named pages — within the space or into another space (a cross-space mv needs -y).
- Find pages with
find. You can use-name PATTERN,-maxdepth N,-mtime [+|-]N(last update, not created; spaces never match), or-prune(print a match and do not descend — useful with-mtimebeforemv -n). Press Esc or Ctrl+C to stop a long search. The search index used by-mtimemay lagls -lright after edits. - Filter paths with
find | grep …orls | grep …. - Pass the page names to
mvorcp, or pipe the paths fromfindorgrep.
These commands move and copy pages. They don’t replace text in page titles or content.
How is find … -exec grep different from find | grep?
Section titled “How is find … -exec grep different from find | grep?”find | grepfilters paths in the results.find … -exec grep PATTERNsearches page content in the page tree.
Can I inspect page history?
Section titled “Can I inspect page history?”Yes. Use checkout (or its alias, restore) to list recent versions or restore a previous version. The restored version becomes the current version.
Are personal spaces included?
Section titled “Are personal spaces included?”Yes. At /, ls and tab completion include global, personal, collaboration, and knowledge_base spaces. Archived spaces aren’t shown. Use cd to open a personal space just as you would any other space.
Can I print an ASCII page tree?
Section titled “Can I print an ASCII page tree?”Yes. Use tree [PATH] [-L N] (or --maxdepth N / -maxdepth N). Default PATH is .; default depth is 3. Output uses classic box-drawing characters with space, page, and folder titles. Caps and interrupt (Esc / Ctrl+C) follow the same spirit as find. This is a visual listing. Folders appear in the tree too. To copy a tree, see Can I copy a whole page tree? below.
Can I copy several pages at once?
Section titled “Can I copy several pages at once?”Yes. Pass several named sources, a glob, or a pipe from find:
$ cp pageA pageB ./folder$ cp Draft* ./folder$ find . -name 'Draft*' | cp ./folderAt most 100 sources. Preview with -n. If a source title already exists under the destination, that source is skipped and reported.
Can I copy pages to another space?
Section titled “Can I copy pages to another space?”Yes. cp ./Page "/Other Space/Parent" copies into another space and does not need -y (a cross-space mv does need -y). To copy a page tree into another space, use cp -r -y ./folder "/Other Space/Archive" (-y is required for cp -r).
Can I copy a whole page tree?
Section titled “Can I copy a whole page tree?”Yes. cp -r -n SOURCE DEST previews, and cp -r -y SOURCE DEST copies the page and all its children under DEST, with attachments, labels, and page restrictions. Titles get a prefix (Copy of by default; change it with --prefix). At most 200 pages per tree; DEST may be in another space. See Copy a page tree.
Can I add or remove labels on many pages?
Section titled “Can I add or remove labels on many pages?”Yes. label add NAME... PATH... -y and label rm NAME... PATH... -y work on up to 100 pages, or pipe from find: find . -mtime +365 -prune | label add needs-review -y. Preview with -n. List labeled pages with find -label needs-review. Labels use the global prefix. See Label stale pages for review.
Can I archive old pages?
Section titled “Can I archive old pages?”Yes, on Confluence Standard or above (not Free). find . -mtime +730 -prune | archive -n previews, | archive -y sends the pages to Confluence’s native archive (restorable in Confluence). Shell archives one page at a time, max 100 per run. See Archive stale pages.
Can I delete several pages at once?
Section titled “Can I delete several pages at once?”Yes. rm -n ./a ./b previews and rm -y ./a ./b moves them to trash. Globs (rm -y Draft*) and pipes (find ./Old | rm -n) work too, max 100. Deleting a parent does not delete its children, so pipe the whole find output when you want to trash a tree.
Can I list, find, delete, or rename attachments?
Section titled “Can I list, find, delete, or rename attachments?”Yes, for page attachments with attach (not uploads). List with attach ls [PAGE]. Find across a page, space, or folder with attach find [PATH] -size +10M -mtime +365 -name '*.pdf' (add -ls or --format csv for details). Sum sizes per page with du -h [PATH]. Delete moves an attachment to trash: attach rm -y NAME [PAGE], or attach find … | attach rm -n then -y (max 100). Rename: attach mv -y OLD NEW [PAGE]. There is no upload or purge. See Find large or old attachments.
Does Shell work with Confluence folders?
Section titled “Does Shell work with Confluence folders?”Partly. ls, cd, find, tree, du, and attach find include folders. mv, cp, rm, archive, label, touch, and chmod refuse folder paths for now. Folder listings come from Confluence search, so a folder created or moved a moment ago may not show up yet.
Can I define command shortcuts?
Section titled “Can I define command shortcuts?”Yes. alias name=command saves a shortcut in your browser, and unalias name removes it. An alias can’t replace a built-in command name.
Can I change who can view or edit a page?
Section titled “Can I change who can view or edit a page?”Yes, with chmod. It lists or changes explicit Confluence page restrictions (view / edit) for users and groups. It is not Unix modes (no 755 / u-g-o bits). There is no chown in this release.
- Preview with
-n/--dry-run. Writes require-y/--yes. - Examples:
chmod PATH,chmod -y read=+u:ACCOUNTID PATH,chmod -y clear PATH(pipes intochmodare supported where the console already pipes into other commands). - If a multi-action run fails partway, the result says what was partially applied (it does not silently half-apply).
- Space-level permissions and recursive (
-R) changes are out of scope. No new Forge scopes were added for this feature.
Why does Shell ask for page delete permission?
Section titled “Why does Shell ask for page delete permission?”Shell uses delete:page:confluence so commands like rm / del (and Confluence operations that model a move as delete+create where applicable) can work. See Why these permissions for the full scope table. No new scopes are being added.
What commands are available?
Section titled “What commands are available?”Navigation: ls, ls -l (pages: id status vN owner date title url; root spaces: type status id owner created name url), ls --format csv / ls --format=csv (header + RFC 4180; UTC ISO; terminal output, no >), cd, pwd. Discover: find (-name / -maxdepth / -mtime / -label / -prune; -ls / --format csv; -exec grep for page bodies), tree (ASCII page/folder tree; -L / --maxdepth; default depth 3). Organize: mv, cp (glob */? on source argv; max 100; cross-space mv needs -y), cp -r (page tree, max 200), rm / del (several paths, globs, or pipe; max 100; requires -y), archive (Confluence native archive; Standard+), label (bulk add / remove), touch / mkdir. Attachments: attach ls, attach find, du, attach rm -y, attach mv -y (page attachments; trash only). Page restrictions: chmod. Inspect and process: cat, open, echo, head, tail, less, grep, wc, sort. History: checkout / restore. Help: help, help <command>, help |, help ^. Pipes: ls | grep …, find | grep …, find … | mv DEST, find … | cp DEST, find … | label add NAME -y, find … | archive -n, find … | rm -n, attach find … | attach rm -n, find … | less, cat path | head. Body search: find … -exec grep PATTERN. Shortcuts: alias, unalias (persisted in this browser). Themes: theme, theme font, theme size, theme height (persisted in this browser).
User guide: /shell-for-confluence-cloud/guide-for-users/
Use cases: /shell-for-confluence-cloud/guide-for-users/use-cases/
Overview (no install counts): Shell for Confluence intro