One OS X trick that makes Dropbox even more useful…
Time was, if you wanted to save something to Dropbox, you needed to move it into the Dropbox folder. Over time, this lead myself and many others like me to be proud owners of Dropbox folders that were unwieldy, disorganized, and headache-inducing.
Then, one day, I learned this trick…
First, a touch of background.
Linux/UNIX types will be familiar with the concept of a symbolic link (aka, “symlink”). While it’s not exactly like an alias in OS X, it’s quite similar in practice. In a nut, a symlink is a small file that links to the “real” version of that file in a different folder.
Since symlinks are ordinarily created using the Terminal, they can be a touch… inaccessible to most Mac users. This makes sense since’s it’s much easier to dork things up using the Terminal.
Under the hood, OS X looks and smells a lot like UNIX, offering many of the same applications available on UNIX/Linux (
ls, and a whole slew of others). One such application is
link—usually abbreviated as
ln—which is used to create hard and symbolic links.
Oh, and for the uninitiated,
~ is Terminal shorthand for your home directory (
/Users/[your username]/). You’ll see that a bit below.
Fascinating. Get to the point, dude.
Using symlinks, we can add files and folders to Dropbox without actually moving them into the Dropbox folder. They’ll be copied up to Dropbox’s servers and synced to all other devices, just like files that actually live in the Dropbox folder.
Put another way, using this trick, you can organize your files and folders however you like and keep select items in Dropbox so they’re backed up and accessible from anywhere. It’s really spiffy.
Here’s how to do it…
First, pick the folder you want to add to Dropbox. For the sake of this example, I’ve got a folder on my Desktop called “Fakery” that contains a single Markdown file. To add this folder to Dropbox using a symlink, I execute this command:
ln -s ~/Desktop/Fakery ~/Dropbox/Fakery
ln launches the
link application; the
-s parameter indicates that we want a symbolic link (as opposed to a hard link). Finally, we have the source and target directories.
Once I issue this command, I can look in my Dropbox folder and see that Fakery has been added and that something.md is indeed present:
And that the file has been synced to Dropbox:
Any changes I make to the Fakery folder will appear in Dropbox automatically. If I add another file to the Desktop folder—called
somethingElse.md—that file will appear in the Dropbox folder (and be synced):
Other folders that might be good candidates for this trick include Documents and Photos.1
Like any fun and useful trick, this one comes with a couple of caveats:
- If you move, delete, or rename the source folder (
~/Desktop/Fakery/, in the above example), the symlink in Dropbox will stop working. If you need to change the name or location of the source folder, you’ll need to recreate the symlink afterward.
- Anything you add to Dropbox this way will count against your total storage (sorry if this seems obvious, but a few of the folks I’ve shown this to in the past were a little thrown off).
As always, be careful. Measure twice, cut once, etc.
One more related trick: if you’re working in the terminal and you need to type the full path to a file or folder, you can easily do it by dragging said file or folder into the Terminal where you’re working…
And it will insert the full path to that file or folder:
(Magician image courtesy of Wonderlane)