learning to be human, since 1984
Archive for Monday 29 March 2010
Using Windows 7 Symlinks
2784 days
I ran into a problem with integrating my web development/design projects on my computer with my local webserver. To further explain:
- I keep all my professional work, including client files, on a separate hard drive partition so that I can easily and regularly back them up, let’s call it g:\
- Client files for web projects are organized as such: g:\clients\client-name\project-name , so that if a long-term client wants a site redesign, I can easily keep these separate rather than dumping them into a single public_html directory for each client
- My local testing server is pointed at a different partition, let’s call it h:\
- I want to be able to serve individual projects via the testing server, but only work on the project files
Naturally, I thought of unix aliases but I’m currently running Windows 7 so I tried shortcuts. Didn’t work. After a little digging, I found the solution: symlinks (which work in numerous OSes – thanks for the correction). From the command line, type:
mklink /D H:\target\directory\linkname G:\clients\client-name\project-name
mklink /D creates a symlink, or a soft link that is the Windows equivalent to unix aliases. The first argument is the directory where you want the link to be placed, and the second is the source directory. Easy as pie.
Be careful when deleting/writing content – the linked directory allows you to manipulate the original file!