Bulk Delete Attachments

Using this job, you can schedule attachments to be deleted based on selected criteria. An example is available at the bottom of the page.

Create a Bulk Delete Attachments job

Follow these steps to create a job: 

  1. Navigate to General Configuration > ScriptRunnerJobs
  2. Select Create Job
  3. Select Bulk Delete Attachments Job
  4. Enter a Note to help you identify the job. 
  5. Enter the User that the job runs as. 

    You can create a user specifically for the automated jobs. For example, automation user. 

  6. Enter the Space you would like the job to operate within
  7. Select the page tree and/or pages on which you want the attachments to be evaluated for Page Tree(s). 
  8. Select the Attachment Age to choose the age of attachments that will be deleted. 
    Your choices are 
    • Preset Filters
      • Older than 6 months
      • Older than 1 year
      • Older than 2 years
      • Created within the last month
      • All 
    • Custom Filters
      • Created with the last
        If you choose this, Created Within the Last appears, where you can select your numerical value and Days, Weeks, Months, or Years
      • Older than
        If you choose this, Older Than appears, where you can select your numerical value and Days, Weeks, Months, or Years
  9. Select the checkbox for Notifications if you want to send notifications for the update. 
  10. Select Add
    You can also select Run Now to run the job immediately. 


Delete all attachments older than three years in a space

If you want to maintain a Demonstration Space by deleting all attachments older than 3 years every year, follow these steps: 

  1. Enter Delete attachments older than 3 years old every January 1 for Note
  2. Enter admin for User
  3. Enter 0 0 0 1 1 ? for Interval/Cron Expression
  4. Select Demonstration Space for Space
  5. Select all the page trees for Page Tree(s)
  6. Select Older Than for Attachments Age
  7. Enter 3 and select Years for Older Than
  8. Leave the Notifications checkbox blank. 
  9. Select Add

That job is now saved to the main Jobs page, and it will run every January 1 at 12 AM. 

On this page