How to have Dropbox ignore a local folder within its synced directory

As I’ve written about before, I store all of my images on Dropbox. As I sync photos to my iOS devices from iTunes, however, I have a bit of a problem: a 42 GB iPod Photo Cache taking up a ton of room on my Dropbox account:

What is in this folder? Here’s what Apple says:

When you use iTunes to sync photos to your iPhone, iPad, or iPod, iTunes creates a folder called iPod Photo Cache. The iPod Photo Cache stores photos that are optimized for display on your device. The location of this folder depends on the syncing options you select. In iTunes, if you change the selection in the Sync Photos From menu, a new iPod Photo Cache folder will be created (and the previous folder will remain).

The iPod Photo Cache grows over time, so nuking it every once in a while is helpful, as iTunes will rebuild it as needed. Here’s a note from that Apple support document:

If you need to free up space on your hard drive, you can remove the iPod Photo Cache folder. Deleting this folder won’t remove the original images from your library, and the folder will be recreated the next time you sync Photos with your iPhone, iPad, or iPod.

If I can’t get rid of this folder, I can at least make it where it’s just taking up space on my local disk, not on my Dropbox account.

I thought this could be done with a simple symlink.

First, I moved my iPod Photo Cache to my local disk, in my Documents folder. I then created the symbolic link in Terminal. A symbolic link (or symlink) functions basically like an alias.

Here’s the command:

ln -s /Users/Stephen/Documents/iPod Photo Cache /Users/Stephen/Dropbox/Photos/Photo Library

The first path tells the command where I want the files to actually reside. In my case, I want my iPod Photo Library to be in my Documents folder.

The second path — separated by a space in the command — tells Terminal where the symlink should go.

I set all this up, then realized that Dropbox will follow a symlink, and still sync the contents of the folder. In short, this did not actually saving me any space.

(I’ve read mixed things about using Aliases to trick Dropbox into doing things, but they all seem fragile.)

I then looked at Dropbox’s selective sync settings, but it does the opposite of what I actually need:

As I need this folder to live only on my local disk, but in a directory whose other contents are syncing with Dropbox, this does the opposite of what I actually need.

There is, however, a way to have Dropbox ignore a local folder via its selective sync settings. Here’s what I did to keep my iPod Photo Cache folder in place, but not eat up tons of space on Dropbox:

  1. I took my iPod Photo Cache folder out of my Dropbox directory and made sure it was gone from the Dropbox website, as a backup to keep iTunes from having to re-build it.

  2. I then created an empty folder in its place with the same name and told Dropbox’s selective sync feature to ignore it. This made Dropbox think it just has an empty folder in the cloud, and after a moment, the dummy folder disappeared from my local Dropbox folder.

  3. Next, I drug my original iPod Photo Cache folder back to its original location. Since the Dropbox app is set to only keep a copy of the folder on the cloud, it won’t attempt to sync a local folder in the same directory with the same name.

Now my iPod Photo Cache is where it should be, and iTunes can have its way with it, all while being ignored by Dropbox:

If Dropbox’s selective sync ever loses that setting, my big-ass folder will try to sync again, but for now, I’m saving a good bit of space on my paid account, which is good news.