Bulk Delete Attachment Versions
You can only use this script to work with spaces that you have admin permissions to.
Use this script to delete old attachment versions throughout your instance. Since old versions are kept each time a new version is saved, this can free up a lot of space in your instance.
Run this script
To use this script, follow these steps:
In CQL Query, enter a query to select attachments.
For help with CQL, visit CQL Guide. You can also select Show Examples to see and use example queries.
Specify the minimum age of attachment versions you want to delete in Attachment Version Age.
Specify the minimum number to keep regardless of the age selected in Minimum Versions to Keep. Leave the field blank if you only want to retain the latest version.
- Check the Notifications box if you want to send notifications for updates.
If the Notifications box is not checked, watchers of the page do not receive an email notification that the attachment versions have been deleted. Select Run.
You can select Preview instead of Run to view changes before implementing them.
Results: Once you select Run, the Results of the script appear.
Example
Delete attachments older than 5 years old
Follow these steps to run a script that deletes attachments in a certain space that are older than 5 years old while retaining the current version:
- Enter a CQL Query to select attachments in a space, like
type = attachment and space = DS
. - Enter Older than for Attachment Version Age, and then enter 5 and select Years when the Older Than fields appear.
- Enter 0 (or leave blank) for Minimum Versions to Keep to retain the current version.
- Leave Notifications unchecked.
- Select Run.
Results
The script returns what attachments have been deleted: