Automator workflow of the month: Clear the iPod photo cache
Many Mac users discover that their Macs’ storage space mysteriously declines over time. This can happen for obvious reasons, of course—you’ve downloaded a lot of files or created movie projects. But it can also happen because of the operating system's work behind the scenes.
For example, you might not be aware that when you sync photos to your iOS device or photo-compatible iPod, iTunes creates separate versions of those photos and stores them within your iPhoto library. These files are never deleted and pile up over time. And the longer you have them, the less likely that you’re even syncing all of them to your devices.
To view that collection of photos locate the iPhoto Library archive (found by default in youruserfolder/Pictures), Control-click on it, and choose Show Package Contents from the resulting menu. In the iPhoto Library window that appears, select the iPod Photo Cache folder and press Command-I to bring up the Info window. You may be surprised how much storage this folder consumes. (I had one that reached nearly 30GB.)
You can, of course, manually access this folder every so often and clear it out. When you do, you don’t risk losing your original images, only the smaller versions synced to your mobile devices. When you next sync your photos with the device, new versions are created and synced.
The danger is that you may forget to do so until your storage limitations are critical. Why not automate the process to avoid this problem? It’s easily done with Automator.
Set up the workflow
Launch Automator and in the template sheet that appears, choose iCal Alarm, and click the Choose button. In the first column of the Automator window select Files & Folders. Then, drag in these actions from the second pane to the workflow area in this order: Get Specified Finder Items, Get Folder Contents, and Move Finder Items to Trash.
Switch over to the Finder, locate your iPhoto Library archive, Control- (or right-) click on it, choose Show Package Contents, and in the iPhoto Library window that appears, drag the iPod Photo Cache folder onto the first action (Get Specified Finder Items). Save your workflow and give it an appropriate name—Trash iPod Cache, for example. Click Save and iCal will open. If iCal doesn’t already have an Automator calendar, one will be created.
Schedule the workflow
A Trash iPod Cache event will appear on today’s date. Select it, press Command-E, and configure a date and time you’d like the workflow to be executed. Then, from the event's Repeat pop-up menu, choose how often you’d like the workflow to take place—once a month or once a year, for instance. (For my workflow I choose Custom from the Repeat pop-up menu and then have the workflow trigger every two months.) When the workflow executes, the contents of the iPod Photo Cache folder will be moved to the Trash.
When you next sync your device, iTunes will recreate these images, but unless you’re syncing thousands of them, it takes no more than a few minutes to do this. For many people, this slight inconvenience will be worth the storage savings they gain.
More broadly, you can use this workflow for any files that you want to routinely clear out. Simply find the folder that houses them and place it in within the first action.