Automatic Emails When Folder Contents Are Changed Using AppleScript

My friends and I use a shared folder I have on Dropbox (called our “Flash Drive”) to share files between one another. I have Growl, which notifies me any time something gets added already, but my friends don’t, and don’t check the folder nearly as much as I do. Instead of waiting a couple days/weeks and asking “hey, did you know ____ was in the Flash Drive?”, I decided I wanted to send them automatic emails.

The first place I looked was IFTTT, but unfortunately they only work with the Public folder on Dropbox at this time. I also looked at using a combination of Wappwolf and IFTTT, but by the time I was at that stage, I felt it would be a cop out.

I settled on using AppleScript and OS X’s built-in Folder Actions. Here’s what I did:

  1. Created the script below (thanks to @applescriptguru for the error checking!)
  2. Saved the script to ~/Library/Scripts/Folder Action Scripts/
  3. Right-clicked on the folder I wanted to monitor, choose “Folder Action Setup…”
  4. Clicked “Enable Folder Actions” (if it’s not already), added the folder to the left-hand column, and then chose the new script on the right.

Just like that, I and my friends now get notifications any time anyone (not just me) shows up in that folder. Plenty of other real world applications for this handy hack.

Posted: Sunday, Oct 21, 2012