AppleScript: Delete old folders
Continue reading to learn how to create this AppleScript.
Creating the AppleScript
Open Script Editor.app (it can be found in /Applications/AppleScript). When you have the application opened, type (or copy / paste) the entire AppleScript below.
set backupFolder to (choose folder)
tell application "Finder" to set theseFolders to (get folders of backupFolder)
repeat with oneFolder in theseFolders
if (creation date of (info for oneFolder as alias) < (current date) - 30 * days) then
tell application "Finder" to delete oneFolder
When you are finished, your script should look similar to the one below.
You can save this script as an application by clicking File > Save As, and choosing "Application" from the "File Format" drop-down box. Type a name and location for your script to be saved and then click the "Save" button.
To run this script, you can double-click on the application that you just created or you can drag it into the dock for easy clicking. When you run the script, you will be presented with a dialog asking you for a folder. Browse to the parent (top-level) folder that contains folders you would like to be searched by date. The script will then find the folders that are older than 30 days and move them to the Mac OS X trash bin.
- Before you remove the files from the trash bin, make sure they are the files you wanted to delete.
- This script only removes folders, so be sure to organize your files within the folders accordingly.
- Be cautious when using this script, as it moves files. TUAW is not responsible for data loss due to incorrect usage of this script.
Deals of the Daymore deals
Software Updatesmore updates
- Evernote introduces reminders to Mac, iOS apps
- Poser 10 and Poser Pro 2014 available, bringing new characters, physics and more
- Agile Partners releases Lick of the Day 2.0
- Google announces new Hangout app to hit iOS today
- Microsoft Office for Mac 2011 Update 14.3.4
- Pixelmator 2.2 available with over 100 new features and improvements