Skip to main content

Delete old attachment versions

Delete old versions from attachment history and keep the current file, so a space stops using storage on versions nobody opens. On the Tools page, this is Delete Attachment Versions.

Applies to: Script Master for Confluence Β· Cloud

Before you begin​

  • Confluence permission: permission to delete attachment versions on the pages in scope.
  • App permission: an admin has set Delete Attachment Versions to All users or Restricted to groups. The tool starts out Disabled. See Set who can use each tool.

Delete old versions​

  1. Go to Apps > Script Master Tools, then select Delete Attachment Versions.

  2. Under Scope, choose Whole spaces and pick the spaces, or choose Custom scope (CQL) and enter a query. With Whole spaces, you can also pick a page in Page tree. A page tree can hold up to 100 pages, the picked page included; for a bigger one, pick a page lower down or use Custom scope (CQL).

  3. Under Version age, choose how old a version must be, for example Older than 1 year.

  4. In Keep at least, set how many of the newest versions of each file to keep whatever their age. The default is 3, and the most is 100.

    The Delete Attachment Versions form with Version age set to Older than 1 year and Keep at least set to 3

  5. Select Check versions. The tool reads each file's history and lists only the files with versions to delete.

  6. Clear the rows you want to keep, then type DELETE in Type DELETE to confirm.

  7. Select the Delete button, which shows the number of selected versions.

    warning

    Deleted versions don't go to the space trash. Nothing can bring them back.

Result: Version history trimmed says how many versions were deleted, across how many files. Each file's current version stays.

How the keep rule works​

  1. The current version is never deleted.
  2. The newest Keep at least versions stay, whatever their age.
  3. Of the rest, only versions created on or before the age cutoff are deleted. A version with no recorded date counts as too new.

For example, a file has 10 versions, all over a year old. With Version age set to Older than 6 months and Keep at least set to 3, the tool deletes versions 1 to 7.

What the check tells you​

LineWhat it means
N attachments have versions that match the age and keep ruleFiles with versions to delete. Zero is a warning, not a failure.
Only the first 1,000 attachments in scope are includedThe scope holds more files. Narrow it and run the tool again for the rest.
N versions selected across N attachmentsThe rows you left selected.
The current version of every file is keptAlways true.
This cannot be undoneVersions don't go to the trash.

The tool looks at up to 1,000 attachments per run, fewer than other tools, because it reads each file's history before you confirm.

What it changes​

ItemEffect
Old versionsDeleted for good.
The current version and the attachmentKept. To remove whole files, use Delete attachments in bulk.
Page watchersNot emailed.
Space logos and files not on a pageLeft out. The tool only lists files attached to pages.
Freed storageNot reported. Confluence Cloud doesn't give a size per version.