Saturday 16 November 2013

Create a Junction or Symbolic Link in Windows with mklink

http://en.wikipedia.org/wiki/NTFS_symbolic_link
Mklink will create a symbolic link to a directory, allowing you access to files within that directory. A reason why you would want to create junctions is for example if you install a program that only let's you run it from a certain directory, you can make it believe it's in the original directory but in reality it's on a different drive.

Or for example you have a SSD on your Laptop drive and since those are usually smaller and more expensive than conventional hard disks, you might want to put directories which eat up a lot of space on an external USB drive and only create a symbolic link in the original folder that points to the actual location.

One such directory would be your itunes backup folder at C:\Users\YOURUSERNAME\AppData\Roaming\Apple Computer\MobileSync\Backup. (Close itunes first in case it's running then) Just move the Backup folder to a new location for example to E:\itunes\ on your external USB drive and create a junction in the original directory (C:\Users\YOURUSERNAME\AppData\Roaming\Apple Computer\MobileSync\) that points to the new one by opening a command prompt* in the original directory and type mklink /j backup E:\itunes\Backup.

Another space eater would be your itunes media folder in C:\Users\YOURUSERNAME\Music\iTunes\iTunes Media. Just move "iTunes Media"to (using our previous example) to E:\itunes and in the C:\Users\YOURUSERNAME\Music\iTunes\ open a command prompt and type mklink /j "iTunes Media" E:\itunes\"iTunes Media". (the " are necessary when there is a space in the folder name)

Just remember (in this example) you should have the external USB drive connected to your computer every time you use itunes to play media or sync with your iOS devices. To list all the junctions which are on your drive type dir /aL /s C:\", where "C:" is the volume to scan. To remove or delete a juction just delete it like any other file or folder.

*click start and type cmd then cd C:\Users\YOURUSERNAME\AppData\Roaming\Apple Computer\MobileSync\

No comments: