How to create a symlink or symbolic link on Windows Server 2008 to help share folders

A symlink or symbolic link can be easily created in Widows Server 2008 to share a common folders or files amongst projects. Lets assume you have a folder in domain1.com called CSS and you want to share this folder with domain2.com. You could just upload the CSS folder into domain2.com but then you need to FTP and update the CSS folder in 2 places. If both sites are using the exact same CSS this could cause you issues over time as you might forget to roll out updates from one site to another.

Using Windows Server 2008 you could create a symlink to solve this issue. Once you have the CSS folder created on domain1.com then you can run the following command from the command line on the server to create a symlink:

MKLINK /D C:\inetpub\wwwroot\domain2.com\CSS C:\inetpub\wwwroot\domain1.com\CSS

The format of the above is: MKLINK [new directory] [where to generate the new folder] [target folder you want the new link to go to]

If you're using Windows Server 2003 you can achieve something similar using:

fsutil hardlink create c:\foo.txt c:\bar.txt

There is a good answer on serverfault.com that covers this topic quite well - http://serverfault.com/questions/7109/how-do-i-create-a-symbolic-link-in-windows

blog comments powered by Disqus

Get In Touch

Follow me online at TwitterFacebook or Flickr.

Latest Tweets