Redirect folder on one HDD to a folder on another HDD

This may be a simple question but I couldn't find any answers - folder redirection usually refers to redirecting profile folders only.

I have two hard drives in my laptop: C: (an SSD) and D: (a regular hard drive). I'd like to keep some files on C: but transparently access those files through the D: drive. For example, I'd like to have:

  • C:\Source - this is where I want my physical files to be stored.

  • D:\X_Drive - this folder is mapped to a virtual X: drive, using subst X: D:\X_Drive.

  • X:\Source - when I go into this folder, I'd to see the contents of C:\Source.

Effectively, I'm looking for a way to map D:\X_Drive to C:\Source. How can I do this? I have Windows 7 Ultimate.


Solution 1:

Junctions (also called symbolic links or reparse points) allows you to do that. You can use mklink in the command prompt (with /D for directory) to create them:

mklink /D C:\Source D:\Source

This will be transparent to applications - that is they will see it as a regular folder.

In Windows Vista/7, it is safe to delete C:\Source from Windows Explorer, or from the command prompt (del C:\Source) as it will only delete the link, without affecting the content of your target folder (D:\Source). However, in WinXP/2000 it would also delete the target content, so you should use rmdir, or the Sysinternal Junction utility in this case.