Skip to main content

Delete attachments in bulk

Move old or unwanted attachments to the space trash in one run, without opening every page. On the Tools page, this is Delete Attachments.

Applies to: Script Master for Confluence Β· Cloud

Before you begin​

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

Deleted attachments go to the space trash. You can restore them from there until someone purges the trash, which is a separate step in Confluence.

Delete attachments​

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

  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 to limit the run to that page and the pages below it. 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 Attachment age, choose how old a file must be: Older than 6 months, Older than 1 year, Older than 2 years, Older than 5 years, Custom… or Any age. A custom age is a whole number up to 100, in days, weeks, months or years.

    The Delete Attachments form with the Scope buttons, the Page tree picker and the Attachment age select

  4. Select Check attachments. A table lists the matching files with their page, size and last-modified date, 20 rows a page. Every row starts selected.

  5. Clear the rows you want to keep.

    The check report and the table of matching attachments, above the Type DELETE to confirm field

  6. In Type DELETE to confirm, type DELETE.

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

    note

    The files go to the space trash. Once someone purges the trash, the deletion is permanent.

Result: the summary says how many attachments moved to the trash and how many had already been deleted. It lists up to 10 failures with the reason for each.

What the check tells you​

LineWhat it means
N attachments match the scope and age filterHow many files the query found. Zero is a warning, not a failure.
Only the first 5,000 attachments are includedThe scope matched more. Narrow it and run the tool again for the rest.
N of them are selected for deletionThe rows you left selected. Frees N KB once the trash is purged says how much storage they take.
Deleted attachments go to the space trashYou can restore them until the trash is purged.

What it changes​

ItemEffect
Each selected attachmentMoved to the space trash, with all its versions.
The page it's onUnchanged.
Page watchersNot emailed.
StorageFreed only when someone purges the space trash.
Space logos and files not on a pageLeft out. The tool only lists and deletes files attached to pages.

A file someone else deleted between your check and your run counts as already deleted, not as a failure.

Undo a run​

Restore the files from the space trash in Confluence. Once someone purges the trash, they're gone for good.