Nicolas Frankel is an IT consultant with 10 years experience in Java / JEE environments. He likes his job so much he writes technical articles on his blog and reviews technical books in his spare time. He also tries to find other geeks like him in universities, as a part-time lecturer. Nicolas is a DZone MVB and is not an employee of DZone and has posted 229 posts at DZone. You can read more from them at their website. View Full User Profile

Symbolic links for Windows

02.07.2011
| 5193 views |
  • submit to reddit

No Java this week, just the solution of a problem I’ve encountered in the past weeks. Don’t be scared, it’s computer-related.

Since a couple of months, I’ve become severely addicted to the excellent Dropbox. It has three features, that linked together are particularly interesting for me: online backup, computer synch and file sharing. If you don’t already have an online storage solution, look at it ASAP: it has a free 2Go version (and by the way, contact me at nicolas at frankel dot ch so we can both benefit from 250Mo more).

Anyway, Dropbox has all I was looking for an online backup software, and even more, but it suffers from one major drawback: it saves only the content of a single folder (albeit recursively). On Nix operating systems, a healthy dose of symbolic links resolves the problem. However, I’m mostly a Windows user (my bad), not only at work but also at home.

At first, I reluctantly broke my nice directories tree organization but it felt wrong. And it was rightly so (pardon the pun): Windows 7 has symbolic links! Yes, it’s true! For the disbelievers, and provided you have access to both Windows 7 and a command prompt, type mklink.

Now, once you’ve selected your Dropbox folder, type the following in a command prompt:

cd path/to/dropbox/folder
mklink -D name path/to/target/directory

Done! Just make sure you have admin rights. Now if you would excuse me, I must get back to reordering my directories again…

Published at DZone with permission of Nicolas Frankel, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Wujek Srujek replied on Tue, 2011/02/08 - 2:18am

Vista had it already. And it has been possible to create Junction Points since Win 2000 or so - JP are not the same, but they would have sufficed for this particular need.

Nicolas Frankel replied on Tue, 2011/02/08 - 6:03am in response to: Wujek Srujek

For XP, I think junction must be downloaded separately. At least, it is what I had to do at work.

Wujek Srujek replied on Tue, 2011/02/08 - 6:21am in response to: Nicolas Frankel

Junction Points are an inherent feature of NTFS version something. The application to create them, on the other hand, was not included by standard. But there were many tools, among other Rekenwonder JunctionLink Magic or sth like this, that I always used. But there was also a CLI tool in some Ms admin pack or sth.

Chris Kaminski replied on Tue, 2011/02/08 - 1:04pm

Go to Microsoft.com and search for linkd.exe. Any Microsoft OS with NTFS version 5 supports junction points. And no, you cannot symbolic link to network shares. Which is a PITA.

Aaron Digulla replied on Wed, 2011/02/09 - 6:39am

Interesting. I'm surprised that Dropbox synchronizes the content of a folder to which a symbolic link points. I would have expected it to create the link without the actual content.

Apparently, this is a design decision by the developers of Dropbox (http://wiki.dropbox.com/TipsAndTricks/SyncOtherFolders).

Tarun Ramakrish... replied on Wed, 2011/02/09 - 7:49am

Just ran into this and had to comment since I was surprised that people were un-aware of sysinternals 'junction'. It allows directory hard-link creation on windows and the tool has been around for ages.

Nicholas Whitehead replied on Thu, 2011/02/10 - 7:14am

Nice. Now if we could just get fifo files........

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.