I love dropbox. But one of the big limitations for the moment is the inability to share subfolders of already shared folders. Why would you want to do this? Well, let’s say I have a folder called “Business” that I share with my business colleagues. Now let’s say I engage a consultant on a project for my business. I’ve created a dropbox folder called “Business/Project” and I want to share just the Project subfolder with the consultants. No can do, if you try it the “direct” way.
But there is a solution, and it works whether you’re on windows, macos or linux. It works by using your platform’s implementation of symbolic links. Here’s how:
Open a command prompt in your dropbox directory (shift right click, select open command window here).
Type: C:\Users\You\Documents\My Dropbox> mklink /J Consultants Business/Project
This will create a folder at the top of your Dropbox directory called Consultants. It will be linked to your Business/Project directory with what is called a Directory Junction. It’s like a shortcut but it’s stronger. Dropbox sees it as a perfectly normal directory and will sync it and let you share it as if it’s totally separate from your Business/Project directory. But behind the scenes Windows has linked the two so when you go into Consultants you’re actually looking at the files that are in Business/Project. They’re not copies or synced copies – it’s literally the same file in both places. When you’re in Consultants “path” in your explorer window will show My Dropbox/Consultants – if we used a shortcut it would show My Dropbox/Business/Project – shortcuts just redirect you.
So what does this mean? You can share your top level Consultants directory with your consultants. They can’t see anything else in your Business directory. Your business partners will see the Projects directory and therefore all the files that the consultants put in it via their shared folder.
Same concept, you use a symbolic link. Open a terminal window, cd to the Dropbox directory then:
user@host:~/Dropbox$ ln -s Business/Projects Consultants
I use this concept to do something a bit crafty. I develop php code on a windows PC using the Uniform Server. It lives in C:\UniServer\www\code. I want this code to be revision controlled by dropbox. So I use a directory junction to link my code dir to a directory in one of my dropbox folders: e.g. Business\Project\code Now dropbox handles revision control for me as I edit my code. No subversion, no cvs – it’s simple easy and works perfectly for lightweight coding. I can’t do diffs or changelogs or any of the fancy stuff that comes with subversion, mercurial, etc but if I’m the only coder then it doesn’t matter to me.
Real-time code push
But wait, there’s more. Now I want to actually push my code in real-time to my development webserver which runs on an AWS EC2 instance. So I do the shared subfolder trick above to create a toplevel folder, e.g. My Dropbox/Dist
I create a new dropbox account and install the linux client on my development server, linking it to my new account. I now share the Dist folder with this new account.
On the linux server I link the Dist folder to my webroot using a symbolic link. The end result? As I make changes to my code on my windows box in the UniServer code directory, dropbox pushes the changes out real-time to my development server so I can see how the code runs there too. I could use this to collaborate with others on the code buy sharing the Dist dropbox folder with them. Our changes are instantly replicated to one another, and if someone does something bad we can recover a previous revision using the Dropbox restore feature on the website. If we need to get fancier we can use git within the folder for better revision control – dropbox will still back everything up its own way as well.
If you think this is useful/helpful, please leave a comment!