Dropbox is great. Most of us already use and love it, that’s why I won’t spend any more words on how awesome it is. Instead, let’s talk about placing symbolic links (symlinks) inside your Dropbox folder (DF).

I’ve personally tested what follows on OS X, and I’ve seen it working on Linux with GNOME or KDE as well. Can’t say if it can be done on Windows too.
As of this writing I’m running Dropbox for Mac v2.0.16 and 2.0.6. Actually I’ve been using this system for quite some time, but I can’t say what Dropbox version was running back then. A quick Google search suggests that it has been possible for a long time.

A couple of small things that annoy me about Dropobox are:

  1. You must pay attention to not accidently move files that you just want to copy. When it happens, the files will be moved out of your DF on computer A, and will therefore disappear from computers B, C and D. If you didn’t intend them to, and don’t realize it until you try to retrieve the files from another machine… well, it sucks.
  2. You have to put everythink you want to sync inside the DF.

About that last complaint: actually, you can use symlinks and sync whatever folder you want (but not files), although it will suffer from the same issue described at point 1.

The process is really simple.
Let’s say that you are on computer A and you want to sync the directory ~/Documents/stuff, which contains file_1.txt and file_2.txt, without having to move it into your DF (default location: ~/Dropbox).
All you have to do is to create a symlink to the target directory inside the DF:

1
$ ln -s ~/Documents/stuff ~/Dropbox/stuff

Now, if you move to your DF you’ll see the symlink:

1
2
3
$ cd ~/Dropbox
$ ls -lF
lrwxr-xr-x  1  username usergroup  34  May 22 00:00 stuff@ -> /Users/username/Documents/stuff

The only important thing about lrwxr-xr-x is the first letter, as it indicates that this is a symlink (the rest of the file permissions string will depend of many factors: umask, account type, etc).
The stuff@ -> /Users/username/Documents/stuff part tells you where the symlink points to. In addition, the -F flag appends qualifying characters to filenames, and @ is used to mark symlinks.

Quick Fact
The -lF flags work on both OS X and GNU/Linux, which is good. Others, however, don’t. For example the -G flag enables color output on FreeBSD Unix and derived systems like OS X; however, on GNU/Linux and other Unix systems it hides the file’s group (and this once caused me a huge headache).
You can compare the man pages for the ls command for GNU/Linux, default Unix, FreeBSD and OS X.
These differences are annoying, because IMHO FreeBSD man pages are far superior to their GNU counterparts (they are clearer, more precise).

Once you have done the above on computer A Dropbox will see the symlink as a directory (it tracks it back to the original entity), upload it, and sync it to your other computer B (or computer_s_, but let’s pretend it’s just one for sake of simplicity). It’s important to note that you can complete this step with the Dropbox client either running or not: it doesn’t matter.

On your computer B Dropbox will create a normal directory inside the DF: ~/Dropbox/stuff. This might work for you, and you can use it this way as you do with any other file or directory inside the DF. Any change you’ll make to ~/Dropbox/stuff on B will be synced to ~/Documents/stuff on A passing through the symlink ~/Dropbox/stuff@ -> ~/Documents/stuff.
The only weird thing is that should you completely remove and trash ~/Dropbox/stuff on B, not only will it delete the symlink ~/Dropbox/stuff@ on A, but it will also empty ~/Documents/stuff on A! To be honest, I’m not sure why it behaves this way.

Ok, let’s push things a bit further by using symlinks on both computers A and B.
In order to do this you must first quit the Dropbox client on B, because you’ll have to move stuff out of the DF and if it is running it will automatically delete it from A.

So, quit the Dropbox client on B and move ~/Dropbox/stuff wherever you like. Let’s say you want to mimic the location of the folder on A, so move it to ~/Documents/stuff.
After you have done it, repeat the procedure described above to create a symlink. You need to have the same situation on both A and B:

1
2
3
$ cd ~/Dropbox
$ ls -lF
lrwxr-xr-x  1  username usergroup  34  May 22 00:00 stuff@ -> /Users/username/Documents/stuff

Now you can relauch the Dropbox client on B and it won’t notice the difference between the original directory and the symlink.

Congratulations! You are now using symlinks on both computers as a bridge to sync independent folders through Dropbox.