Archive stale pages
Move pages nobody has touched in years out of search and page trees — but keep them restorable. archive sends pages to the Confluence native archive (not the trash).
Before you start
Section titled “Before you start”- Your site needs Confluence Standard or above. On Free, Shell stops and suggests a same-space move instead (
find … | mv ./Archive). - Shell archives one page at a time (Confluence runs one archive job per site). Expect about a few seconds per page — up to a few minutes for 100.
- At most 100 pages per run.
1. Find the candidates
Section titled “1. Find the candidates”$ cd YourSpace$ find . -mtime +730 -prune$ find . -mtime +730 -prune --format csv-mtime +730 = not updated for about two years. -prune keeps the top-most match in each subtree. Save the CSV if you want a record of what you archived.
2. Preview, then archive
Section titled “2. Preview, then archive”$ find . -mtime +730 -prune | archive -n$ find . -mtime +730 -prune | archive -yOr archive named pages:
$ archive -n ./Old-runbook ./Retro-2023$ archive -y ./Old-runbook ./Retro-2023Press Esc or Ctrl+C to stop. A page already submitted may still finish on the server.
Combine with labels
Section titled “Combine with labels”Label first, review, then archive what is still stale:
$ find . -mtime +730 -prune | label add archive-candidate -y$ find -label archive-candidate | archive -n- Archived pages are restored in Confluence; Shell has no
unarchive. - Whether child pages are archived with their parent is decided by Confluence — check the result there.
- Spaces and folders can’t be archived.
- Prefer the trash? Use
rm(find … | rm -n). Prefer to keep pages visible? Usemvinto an Archive page in the same space — see Find pages not updated recently.