Skip to content

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.

$ cd YourSpace
$ tree -L 2
$ tree ./Archive -L 3

tree 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).

$ find . -mtime +30
$ find ./Projects -mtime +365 -prune
$ find ./Projects -mtime +365 -prune | head 20

find -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.

$ ls -l
$ ls --format csv
$ ls --format=csv | less
$ ls --format csv | head 30

Richer 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.

$ mkdir ./Archive
$ find ./Projects -mtime +365 -prune | mv -n ./Archive
$ find ./Projects -mtime +365 -prune | head 100 | mv ./Archive

mv 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.

$ find ./Projects -mtime +365 -prune | label add needs-review -y
$ find ./Projects -mtime +730 -prune | archive -n

See Label stale pages for review and Archive stale pages (archive needs Standard or above).

$ du -h -s .
$ attach find . -size +10M -ls

See Find large or old attachments.

  • Cross-space moves and copies are allowed; a cross-space mv needs -y / --yes.
  • tree is a listing; cp -r copies a tree (max 200 pages).
  • Folders can be listed and searched, but mv / cp / rm / archive / label / chmod / touch refuse 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.