Make Dropbox work with multiple OSes / multiple folders

This one’s completely due to my friend Debsankha.
Inquivesta, our science fest website, is a web app hosted via Google App Engine. We, the three developers of the app, use Dropbox to keep our files in sync. This’ll be a short article addressing two obvious issues I faced using the application.

1. How to make Dropbox sync to the same stuff from both Linux and Windows on a dual-boot machine.

The problem I came across while using Dropbox is the following: I have both Ubuntu and Windows installed on my laptop, and use one or the other at times to maintain and update the website. Therefore, it would have been great if I could install Dropbox in both these OSes and sync the same folder from both. I did install it on both OSes, but there was a stupid problem with syncing.

In Windows, when you set the directory in which you want your Dropbox shared folder, Dropbox makes a new folder called ‘My Dropbox’ inside that directory, and syncs it. There is no way to make it sync an already present folder, unless it’s named ‘My Dropbox’ (in which case you should select its parent directory in the Dropbox dialog box).

In Linux, the situation is exactly the same, except Dropbox now wants the name ‘Dropbox’ for its shared folder.

Therefore, you cannot sync the same folder from two OSes.
Stupid, stupid problem. I really think Dropbox should do something about it.

Anyway, Debsankha suggested something very simple and it worked. It’s to use a symlink, or a symbolic link, which is kind of like a shortcut in one place to files and folders in another place, but created at a low level.

Linux

In Linux, I made a symlink named ‘Dropbox’ to my Windows ‘My Dropbox’ folder, and set Dropbox to sync it. Now it was actually downloading files to/uploading files from my Windows Dropbox folder, without any redundant space consumption.

The way to make a symlink from ‘source folder’ to ‘destination directory’ (in my case ‘My Dropbox’ in Windows to ‘Dropbox’ in Linux) in Linux (Ubuntu) is the following:

  1. Using the GUI: Right-click the folder you want a symlink from, and select ‘Make Link’. Copy the symlink that’s created to whichever directory you want it in, and rename it if you want.
  2. From the terminal: Type the following in the terminal:
    $ ln -s ‘source folder’ ‘destination directory’
    Note that the symlink is placed in the ‘destination directory’. It’s not that ‘destination directory’ itself becomes a symlink. Think of the symlink as just a file, and it will be clear.

Windows

I had earlier tried to do a similar thing in Windows using a shortcut, and had concluded:

“It doesn’t. The shortcut syncs as a single .lnk file. Stupid.”

But a comment by Karl on this post has removed this disappointment. I’ll quote him:

“Yes, that is because ordinary Windows shortcuts are just .lnk files that Windows implements as a link to a file/folder, symlinks on the other hand are made on much deeper, filesystem level, the same level your files and folders are.

As of Windows Vista, Windows’s NTFS filesystem also supports symlinks. You can use the mklink command to create them. The syntax is:

mklink link target

In case you want to make a symlink of a directory, you need to use

mklink /D link target

command.

Please notice, that you need to do this using the administrator account (run command prompt as administrator), because the default security police prevents ordinary users from creating symlinks.”

Note that when you make a symlink in Windows, it looks exactly like the file/folder it’s linked to, so it is easy to confuse it for a file/folder actually residing there and taking up space, neither of which is happening. If you modify stuff in the target location, this will change to reflect that. CAUTION: This even works backwards for directory symlinks, so that deleting or modifying stuff contained inside the directory symlink affects the original files. However, the special case of deleting the whole directory that was the symlink itself, doesn’t delete the original directory.

2. How to make Dropbox sync files and folders outside its own folder.

I saw in the Dropbox website that people had a feature request: that Dropbox should be able to sync folders outside a single ‘Dropbox folder’. Dropbox has been delaying this update for a long time, and the users seemed to be very worked up about it. Frankly, now I don’t see what’s the holdup. It’s hilarious. There’s a very simple way to implement it using the above principle. In your Dropbox folder, just make a symlink of whatever file or folder you want synced, using the methods explained before for Linux and Windows.

This came as very obvious to Debsankha, who is used to working in Linux, and he wasn’t gonna post this anyway. I thought, what the heck, some people will definitely be helped with this info (like the ones shouting out their complaints in the Dropbox website).

9 thoughts on “Make Dropbox work with multiple OSes / multiple folders

  1. Karl

    “It doesn’t. The shortcut syncs as a single .lnk file. Stupid”

    Yes, that is because ordinary Windows shortcuts are just .lnk files that Windows implements as a link to a file/folder, symlinks on the other hand are made on much deeper, filesystem level, the same level your files and folders are.
    As of Windows Vista, Windows’s NTFS filesystem also supports symlinks. You can use the mklink command to create them. The syntax is:
    mklink link target
    In case you want to make a symlink of a directory, you need to use
    mklink /D link target
    command.
    Please notice, that you need to do this using the administrator account (run command prompt as administrator), because the default security police prevents ordinary users from creating symlinks.

    Like

    1. Thanks a lot Karl for sharing your knowledge. I’ve tried this out; it works perfectly. I’ve edited the post and quoted you to reflect this information.

      Like

  2. Brian Rypstra

    I tried creating an mklink in a dropbox & the local folders appeared the same even on changes but the external dropbox account didn’t update.

    Like

    1. As an example,
      1. After starting the command prompt in administrator mode, navigate to the location in which your Dropbox folder resides.
      2. Type in ‘mklink newfoldername Dropbox’ (if your Dropbox folder is called ‘Dropbox’). This will create a folder in the same location called ‘newfoldername’ (choose whatever you want).
      3. If you go into this folder you will now see all your Dropbox folder contents reflected faithfully here. These are not new, separate files. You are now actually inside your Dropbox folder. If files are updated in your Dropbox folder, they should automatically be updated here.

      Like

  3. but you must make some sense about shortcut link :

    all symlink will be list and upload your file ..
    so if you have private_html or any shortcut link.. you will found duplicate

    Like

  4. Barnaby

    Hello,

    I’m glad you posted this, but I’m not saavy enough to understand the Win7 fix.
    I’m running two different instances of Win7 (a 32 and a 64), and would also like the Dropbox app to sync to the same folder.

    Would you be kind enough to make a “how-to” tutorial on how to do this ?

    Thanks,

    Barnaby

    Like

Leave a reply to Abhra Cancel reply