If there’s one thing that drives me crazy about Dropbox, it’s the fact that it will only Sync/Backup folders and files which are inside the Dropbox parent folder. GRRR. Last week we showed you a REALLY groovy trick using Dropbox with Microsoft Office to backup your temporary Office documents. Part of the trick involved setting up a Symlink which will sync files and folders with Dropbox, even though their not located under the Dropbox parent folder. The trick is pretty groovy, so I’ve decided it deserves a groovyPost of its own!
How To Sync Any Folder with Dropbox Using Symlinks
When doing this kind of thing, a single typo can kill ya. With this in mind, I like to use Notepad to pre-type all my commands. Then I just paste them into Windows CMD Prompt and limit the issues. So with that said:
Open your Dropbox folder then Copy and Paste the location of My Dropbox into your Notepad. This action will give you the full path which you can then use to build your Symlink command. For most people, the folder path will be “C:\Users\YourUserName\Documents\My Dropbox”
Browse to the folder that you want to have synced to Dropbox and Copy & Paste the path (into the notepad you have open.)
For my example I’m going to Sync the desktop on my user profile:
At this point you should have pasted both in notepad:
- My Dropbox folder path: C:\Users\YourUserName\Documents\My Dropbox
- The path of the folder you want Dropbox to sync (i.e., C:\Users\YourUserName\Desktop)
Now all we need to do is make a few modifications in the notepad so we can easily copy and paste the entire command right into the next step. In the cmd prompt, we’ll be using the mklink /D command. And the syntax for that command is as follows:
mklink /D “New Folder” “Original Folder”
Let’s go ahead and use this command with the paths in our notepad:
Note: It’s important for me to mention a few things.
- I manually created the subfolder Linked in the “My Dropbox” folder. I did this so that later I will remember that all subfolders under the Linked folder are Symbolic Links, not real folders.
- In my example, you must not create the subfolder Desktop under the Linked Parent Folder. The MKLINK command will do this for you, and if the folder already exists, the MKLINK command will fail.
Launch Windows Command Prompt “CMD” as Administrator. Yes, you must be logged in as Admin here.
Copy and Paste the command from Notepad into your Command Prompt Window
To ensure the link was successfully created, now you will now see a message right below where you just pasted the command. It should say Symbolic link created for C:\path1… <<===>> C:\path2…
If you don’t see this message, or if it says “The syntax of the command is incorrect” then it means you
- Typed in the paths incorrectly
- Forgot to include the quotation marks
- You manually created the target folders
The last step is just to check and make sure everything is set up correctly. In your My Dropbox folder, you should now have the new Symlink or Folder you just created. In my example, I created the symlink named Desktop in the parent folder called Linked.
As you can see from the below screenshot, not only was the link successful but the Green checkbox on the files confirm that Dropbox has already backed up the files.
Now that we’re sure the local set up is right, let’s check the Dropbox website to make sure that the syncing is working properly.
Dropbox should show the new symlink as a folder in its online interface. If you open the folder, the contents of it should be backed up to Dropbox and continue as real-time sync as everything else in the My Dropbox folder does.
In my case, my Desktop folder located at c:\User\MrGroove\Desktop along with all its subfolders and files are now in sync with my Dropbox account and replicated to all my other PC and MAC computers. Although this was just an example of what’s possible with Symlinks, it also demonstrates the power and ease of setting up a Symlink. For a very groovy trick using Symlinks and Dropbox, take a look at this article where I use Dropbox to SYNC Temp Files from the office.
- What happens if you delete the Symlink folder you created? Are any files deleted?
- No. The folder is nothing more than a Shortcut or Link to the REAL folder and files. Once deleted Dropbox will remove the files from your account. However, the original files will still exist at their original source (IE: c:\users\mrgroove\desktop.)
- Will I need to recreate the Symlink when I reboot?
- Nope. Once created, the Symlink will exist until you delete it.
- When I create the Symlink on computer 1, will I need to recreate it on my 2nd PC where I have Dropbox installed?
- Nope! On any other computer that you have Dropbox installed on, Dropbox will automatically create the folders and files under the “My Dropbox” Parent folder – just like it does when syncing any other folder or file to other computers currently.
With more complex How-To Tutorials like this one, I expect a lot of questions. So if you are confused or need more help, then please feel free to drop me a note here in the comments. Or you can post your question in the forum to get help more quickly from myself and other groovyReaders!