Skip to content

Instantly share code, notes, and snippets.

@ncremins
Created November 1, 2013 21:37
Show Gist options
  • Save ncremins/7272349 to your computer and use it in GitHub Desktop.
Save ncremins/7272349 to your computer and use it in GitHub Desktop.
Apple script to purge downloads, this can be easily set up in automator to run every day.
-- number of days until purge.
set modDate to (60)
-- Only do for the current user.
tell application "System Events"
set currentUser to (name of current user)
end tell
-- Delete
tell application "Finder"
try
delete (every item of folder "Downloads" of folder currentUser of folder "Users" of startup disk whose modification date is less than ((current date)) - modDate * days)
end try
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment