Feb 042012

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:

On Windows:

Open a command prompt in your dropbox directory (shift right click, select open command window here).

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.

On Linux/OSX:

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!


Be Sociable, Share!

  29 Responses to “Sharing Dropbox subfolders – it is possible!”

  1. How to share a sub folder of an already shared folder. As you may be aware, Dropbox does not allow you to share a sub-folder of an already shared folder. You may need to do to do this in real life. for example if you have directory structure that looks like this
    ———Project A
    ———Project B

    Now let’s say you have Share Directory “B” with your client.

    Now you have files in Project B, that you wish to share with an employee/consultant. But you don’t want to share the entire “B” folder with the consultant.

    Right now there is no way to do this in dropbox.

    Well i dug around and discovered a command called MKLINK. It unfortunately requires the command prompt (which i hate). I discovered a tool called Symlinker http://goo.gl/vuJKN IT is a portable file, so install is required.

    When you run it

    1. Select “Folder Symbolic Link”

    2. In link folder navigate to set the link ” D:\Dropbox\Client\B\Project B\ ”

    3. Give it a name “XYZ”

    4. Destination folder
    Navigate to set a destination folder “D\Dropbox\Client\Consultant\

    5 Select the type of link “DIRECTORY Junction”

    6. Select Create Link

    You are done!

    Now your directory structure will look like this
    ———Project A
    ———Project B

    The XYZ directory is not a real folder but a link to the “Project B” folder

    You can now share XYZ with your Consultant.

  2. Hey – very nice post. Just to give you some SEO insight, I typed in “Can you share a subfolder in dropbox without sharing the top folder?” to get the search query that gave me your site. You are the 5th result down. Anyway, I’m obsessed with SEO, so you’ll have to forgive me on that.

    This is a great post about how to configure Dropbox. I was looking for this option for a very long time because I also use it for Clients and want to share subfolders of an already-existing top-level folder. Kind of frustrating at times when I can’t do it.

    The only thing that worries me about changing my Windows 7 configurations is how it will effect Dropbox across all the other devices that I use it on (i.e. my tablet, smartphone, etc.). What do you think? Will it still function the same? I’m actually going to tweet and post this on our Facebook Fanpage so you can follow this link to see it. Asheville SEO Services. Just click on my social links in the footer to hook up with the Fanpage or Twitter. Let me know if you can’t find them and I’ll make sure to reply back in this thread. (It would be nice to get this post up a little higher in ranking for this topic.)

    Thanks again brother and hayy WordPressing! ;-)

  3. Just an update… In some situations dropbox doesn’t sync the files in the symlinked folder. If this happens just stop and start Dropbox again; it will re-index and sync your files. This is actually now a useful “feature” for my code push system as it let’s me push out code in batches when I’m ready to test.

    Just in case anyone else has that situation…

  4. Hello that seemed to be exactly what i was looking for but despite once i click it says link succesfully created nothing happens (Windows XP)
    Any advise?

    • http://stackoverflow.com/questions/2927929/how-to-create-an-ntfs-junction

      There are some suggestions on stackoverflow on how to accomplish this under XP. The key is that you’re trying to make a directory junction, which is supported on NTFS. I don’t believe FAT-32 file systems have support for it, however. You may need to move your dropbox folders to a partition formatted under NTFS in order for this to work. Let me know how you go, I don’t have access to any WinXP machines to test…

  5. Why don’t they sort this our?? Sugarsync do this so why not Dropbox. A lot of you here have solutions so why don’t dropbox sort a solution. Sugarsync have an advantage in this area over both dropbox and google drive.

    • Sugarsync also has lots of syncing issues which forced us to abandon it in favor of dropbox. Also tried Egnyte, which allows standard server permissions on sub-folders, which is great, but it also has some sync issues.

  6. Hi Wes,

    thank you very much for this hint.
    This is (almost) the solution that I was looking for.

    I tested it and it works great but one problem:
    If I create a new folder locally (Win 7) in the linked directory (in your case Consultant) it shows up in this directory and the “real” directory. All fine.

    But if I login to Dropbox website the new created directory does NOT show up in the directory Consultants!

    This is not VERY bad but could become worse.
    If you create there online a directory in Consultants with the same name as you locally did, its content online is empty – its content in the Dropbox on my PC is still what it was before…

    Best Regards

  7. [...] the rook Dropbox folder and the subfolder (within a shared folder) that I wanted to share. This method works fine for a couple of users, but after that, the root Dropbox folder and the management itself [...]

  8. life for me now has become much easyer !!!! there is a simple method!

    just create the folder you want to share in your root dropbox folder
    than share it with what you want
    than move it where you want!
    you can eve rename it!
    in this way you can create your jerarchic structure without becoming crazy

    read this:


    i hope this helps

    • Hi Jacopo,

      I wish your solution worked, as it would be very easy. But it doesn’t. I can verify this because I created several dropbox accounts and ran them through the following scenario:

      I create the following top level folders:


      I share Workstations with test1, Servers test2 and IT with test3.

      I then move Workstations and Servers into IT. Great, now I have a shared folder with 2 shared subfolders on my system.

      Now as test1 I copy a file into Workstations.

      Sadly, it does not show up in my account or in Test3′s IT/Workstations subfolder. Dropbox has broken the linkage and the file vanishes to nowhereland.

      I thought the problem would happen deeper – e.g. adding users to shares afterwards or sub-sub folders but alas the whole thing breaks pretty early on in the mix.

      Unfortunately, the symlink approach is the only one that seems to work somewhat reliably.

    • Hi Jacopo,

      I’ve run a number of tests and so far this method has worked fine for me. I haven’t had any unfortunate encounters with “nowhereland.”

  9. Hey Wes,

    Thanks for sharing this workaround to a long-standing Dropbox problem. Although it’s among the top requested features in Votebox and someone promised they’re looking into it (a year ago), no announcements have yet been made. For anyone else facing this problem, I urge you to cast your votes here: https://www.dropbox.com/votebox/246/share-a-folder-that-is-inside-another-shared-folder

    Could you please also share with us how Dropbox calculates storage for the symbolic-linked copies?


    • Dropbox doesn’t actually see symlinks – it sees two different files with identical contents. On your system they’re only one file. Therefore it does count twice against your quota. Not great for large files! Also not great when there are lots of small files – you double the index size.

      Yes, a proper solution to this would be great – I believe google drive allows this.

      I think the solution is actually complex to implement, which is why dropbox hasn’t done it yet. It’s very hard to do what dropbox does – which is efficiently stat and sync files across various latency network connections such that collisions are minimized and the user experience is reasonably smooth. We’ve been trying to create a dropbox-like experience via AFS and ZFS and it’s a very tough nut to crack. Real props to Drew & co. for coding something very good at the core.

      Sharing subfolders will make tracking permissions that much harder and creates all sorts of potential loops and boundary conditions which need to be managed. What happens when you move subfolder B from folder A to folder C where A and C have different share lists? Are C people now supposed to have access and A people not? In some cases the “right” behavior is not obvious.

  10. Wow it works!

  11. I think you have a mistake there. At first it kept saying : “invalid switch”, then I realized there has to be backslash instead of normal slash in the target_name part of the code. Now it works like a charm, thx.

  12. Hi Wes. Thanks much for the long time needed tip on subfolder sharing in Dropbox. It baffles me that the Dropbox team hasn´t added this funcionality in it´s otherwise perfect software, but hey… I guess nobody is that perfect. Have you thought about developing an Addon for those of us who are technically challenged? Wouldnt that be a good idea? Thanks again.

  13. Great post, just two things…

    1) you have not mentioned the requirement of the machine with the symlinked folder to remain online at all times to maintain the file duplication between folders, as a file changed by either of the other parties of the shared folders, must then be downloaded to your machine, thus instantly located into both folders, and then seen and uploaded into the other folder on dropbox.

    2) in regard to when the file still does not sync, this is due to the way windows reports file changes, windows only reports file changes at the true location of the file, thus if a file is changed by a sharer of the symlinked folder this file downloads to the symlinked folder and instantly appears in the real folder, windows reports this and the DB app sends it up to that folder in the cloud. However if a file is changed by a sharer of the real folder this file downloads to the real folder and instantly appears in the symlinked folder, but windows does not notify of this event as it only notifies on the true location of files.
    The following link contains a small app that can be installed (source code is included) that monitors for these events and tweaks the file system causing the symlinked folder to be updated. This app was first made available by another party in the dropbox forums. https://dl.dropbox.com/s/t0zqf60wm33v5mn/DropboxSymlinkUpdate_src.zip?dl=1

    I hope people become aware of the requirement of the machine to remain online, and take advantage of this app to complete the effect.

    FYI: (2) is only a microsoft problem, I have been informed that mac and unix OS have no such problem.

  14. Also need this for my business but it already makes problems here:
    “Open a command prompt in your dropbox directory (shift right click, select open command window here).”
    I can open a command prompt but not in my dropbox directory.. It would just not react to shift right click so I opened a command window through Start-Run-cmd.exe

    any advise?

  15. Very helpful, thank you.
    It may be worth noting that this way the collaborators from your “business” folder can not see who you added to the “Project” folder and vice versa. In fact, neither even knows there may be other people with access to this folder.

  16. Thanks – great answer

  17. It works but only as a snapshot at the time of the symbolic link. Windows will continue to view it as the same folder but dropbox will see them as separate folders and will not sync them. I uploaded a video within the symbolic link folder (in windows) but dropbox only put it in the original folder and the symbolic link folder (in dropbox) does not have the video. In fact if I manage this in windows there is nothing I can do to change the contents of this dropbox version of the symbolic link and dropbox only sees me changing the original folder. Windows sees it all perfectly but dropbox does not… You might as well create two separate folders and do the syncing manually… It would be a pain but at least you know it would work.

  18. My question: I did it – but made the junction for the wrong folder – How can i cancel that junction?

    • In windows I believe there are several potential ways for deleting a junction – depending on your version:

      the “rd” command which removes a directory should just remove the junction, not the source. It also might be called “rmdir” in other versions.

      The junction tool by Microsoft might also help: http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx

      You can use the -d flag to delete the junction.

  19. Thanks, Wes! I just linked to your solution from the Dropbox forums:

  20. Hmmm, it doesn’t work for me. I can see the folder in my local DropBox, but I can’t open it – I get a message, “C:\Users\\DropBox\ refers to a location that is unavailable..”

    If I right-click on the new link and select “View on Dropbox.com” then DropBox opens and a red message appears at the top, “The folder / is deleted”

    So I can’t access it, or share it with others. What am I missing?

    Win7 SP1

  21. This isn’t working for me. I successfully created a directory junction between a subfolder and a folder at the top of my dropbox directory. However, it only works unidirectionally: files placed into the top folder are shared with the members of the subfolder, but files placed in the subfolder are not shared with members of the top folder. Is there a mistake I could have made? Has something changed with dropbox in the past couple years? I’m running windows 8.

Leave a Reply