Space hygiene ops
Keep one space tidy without a migration project. This recipe is a vertical workflow: see the tree → find stale pages → list or export → label, archive, or move, plus a quick attachment-size check. It uses Shell for Confluence Cloud 3.11.0 only.
Open the Cloud console, then cd into the space you care about.
1. See the tree
Section titled “1. See the tree”$ cd YourSpace$ tree -L 2$ tree ./Archive -L 3tree prints an ASCII page tree (default depth 3; use -L / --maxdepth to change it). It is a visual listing only. To duplicate a section, use cp -r (max 200 pages).
2. Find stale pages
Section titled “2. Find stale pages”$ find . -mtime +30$ find ./Projects -mtime +365 -prune$ find ./Projects -mtime +365 -prune | head 20find -mtime filters by last update (content version when), not created date. Spaces never match -mtime. Prefer -prune before piping into mv so you keep top-most matches and do not flatten parents beside children. The search index may lag ls -l for a short time after edits.
3. List and export
Section titled “3. List and export”$ ls -l$ ls --format csv$ ls --format=csv | less$ ls --format csv | head 30Richer ls -l shows page id, status, version, owner, last-update date, title, and url. For machine-readable output use ls --format csv / ls --format=csv (header + RFC 4180; UTC ISO). There is no > redirect — copy from the terminal or pipe to less / head / grep.
4. Move (preview first)
Section titled “4. Move (preview first)”$ mkdir ./Archive$ find ./Projects -mtime +365 -prune | mv -n ./Archive$ find ./Projects -mtime +365 -prune | head 100 | mv ./Archivemv and cp take at most 100 sources per run (named paths, globs, or piped paths) and can target another space — a cross-space mv needs -y / --yes. Preview with -n / --dry-run, then drop it when the preview looks right. Split larger sets and run again.
5. Or label / archive instead of moving
Section titled “5. Or label / archive instead of moving”$ find ./Projects -mtime +365 -prune | label add needs-review -y$ find ./Projects -mtime +730 -prune | archive -nSee Label stale pages for review and Archive stale pages (archive needs Standard or above).
6. Check attachment sizes
Section titled “6. Check attachment sizes”$ du -h -s .$ attach find . -size +10M -lsSee Find large or old attachments.
Boundaries
Section titled “Boundaries”- Cross-space moves and copies are allowed; a cross-space
mvneeds-y/--yes. treeis a listing;cp -rcopies a tree (max 200 pages).- Folders can be listed and searched, but
mv/cp/rm/archive/label/chmod/touchrefuse folder paths. - Caps and interrupt: long walks may hit path / fetch caps; press Esc or Ctrl+C while working….
Related recipes: Reorganize pages, Search and audit content. Command details: command reference. Limits: Limitations.