Symlink all sub-directories on Windows 7

Recently, I wanted to create a bunch of symbolic links pointing from an Eclipse workspace to all sub-directories in a given directory (SRC_MAIN). I usually keep the actual source code separate from the workspaces for various reasons and now had to set up a new workspace with a lot of projects in there.  The mklink command finally offers symbolic links (junction creates hard links which come with various side-effects I don’t like) and I needed a small wrapper around it, that I wanted to share.

@echo off
for /d %%A in (.\*) do (
	MKLINK /D %1\%%A %CD%\%%A

In order to keep things lean and easy, there is a prerequisite that the script must be placed in SRC_MAIN (in my case c:\Users\chris\src). The usage for a default Eclipse workspace is then
cd c:\Users\chris\src
symlink_all_subdirs.bat c:\Users\chris\workspace
Nothing sophisticated but perhaps someone can use it (and it’s a backup for me as well).

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.