I admit it–I’m not big on backing things up. This may be the result of never really having experienced catastrophic hard drive failure (knock on wood). Or, it may just be my lazy, gen-x attitude.
At work, I typically save all important documents directly to a “My Documents” share on the file server (IT takes care of backing that up–thanks, Ron). However, I recently started started using a little ToDo list app that really needed its file stored locally (connecting and disconnecting to the server would just be too much for its “every 5 second” autosave). So, how do I back that up on a regular basis? Combine that with the time I’ve spent this week getting my Subversion repositories properly backing up and I decided it was time for a solution.
I had always heard about how cool Automator is on the Mac, but had never really given it much thought. Is it ever (cool)! I was able to graphically set up a simple workflow to make an archive of my local “Documents” folder. Problem was, my 18GB Parallels VM file is in there. With a bit more Googling and some creativity, I was able to exclude that folder (and a few others). More on that later.
So, now, how do I run this bad-boy without physically opening Automator and running it? This article on MacOSXHints.com came to the rescue. You save your Automator workflow as an Application (or, if you read the comments, an iCal Plug-in) and use the iCal alarming capability to schedule it.
I now have automatic backups running every morning at 2am for my iMac at work. Now, I just need to break down and buy that really big external drive for home so I can use Time Machine to back up my personal Macbook.
If you are a casual reader, you can feel free to stop reading here. The rest is pretty technical details on setting up the Automator workflow.
Now, on to the tricky part. If you are trying to use Automator to specify folders, but want to exclude some sub-folders, you are in luck! It’s not terribly intuitive, but what I discovered is that you needed to include a “Get Folder Contents” before you could filter by name. Note that this example only excludes one level deep. It will not drill into subfolders and exclude those. I suppose you could make it do that, but for me, I didn’t need that functionality and this was much simpler and faster. Here is what I ended up with:
- Get Specified Finder Items – Add your “Documents” folder (and any others you want backed up)
- Get Folder Contents – Apparently, this turns Folders into “items” that can then be filtered. Don’t check the “Repeat for subfolders” unless you really really want to drill into every subfolder and create a giant list–it may take a long time to run and exclude items you didn’t expect to be excluded
- Filter Finder Items – Use the “Name” “Does not contain” filter and just add a filter for each item you want to exclude (in my case I created one for “Parallels” and one for “Microsoft User Data”)
- Create Archive – Creates the zip archive and saves it in a specified location
- Rename Finder Items – I used this to append a date-stamp to the filename
- Copy Finder Items – Last step, copy it to a location accessible by Finder. Fortunately, if it needs to mount a network share (even smbfs), it will!
That is my workflow. Hopefully that will help someone that gets stuck on the excluding named folders step. Automator is really pretty neat and who knows, maybe I’ll find some other great uses for it in the near future!