I tried mklink /D (or /J) dir1 dir2
I have a directory 'dir1' with some files in it and a directory 'dir2' where I'll add some files.
You have the directories the wrong way around. You also need to remove dir2 before creating the link.
The syntax for mklink
is:
MKLINK [[/D] | [/H] | [/J]] Link Target
Note:
mklink
creates the link so dir2
should not exist before you run the command.
In your case dir2
will be the new link and dir1
will be the target, so you need to use:
rd dir2
Followed by:
mklink /d dir2 dir1
Or:
mklink /j dir2 dir1
Now dir2
has the files of dir1
(In other words dir2
is dir1
). I don't want that.
That's what directory links are designed to do.
You need to rethink.
One option is to add the files to dir2
and then when in dir1
create symbolic link to the files in dir2
. You can do this with:
cd dir1
mklink file \full\path\to\dir2\file
You have to do this for every new file added to dir2
.
Further Reading
Yeah but now dir2 has the files of dir1 (In other words dir2 is dir1). I don't want that – JohnGRThess – 2016-07-05T17:16:45.507
@JohnGRThess That's what directory links are designed to do. You need to rethink. One option is to add the files to
dir2
and then when indir1
create links to the files indir2
. You can do this withmklink file \full\path\to\dir2\file
. You have to do this for every new file added todir2
. Answer updated. – DavidPostill – 2016-07-05T19:39:52.700