Reputation: 1974
I'm trying to create a symbolic link between two directories. I have a directory called TestDocs and TestDocs2. I will be doing all my work in TestDocs, but I need it all to be reflected in TestDocs2. So all files that are in TestDocs2 will be replicated in TestDocs, and if I add a file, change a file, etc in TestDocs it should be reflected in TestDocs2.
So I thought it would be as simple as just doing this:
mklink /D TestDocs TestDocs2
But when I do that I get the error:
Cannot create a file when that file already exists
Why am I getting this?
Also, do I have the order of my TestDocs and TestDocs2 wrong in the command?
Thanks for the help, Symbolic Links have always confused me!
Upvotes: 27
Views: 79563
Reputation: 19
I had this error. Two things I did to fix it.
First attempt: mklink /d \shared_files ....\my-app-public\src\shared_files gave error described.
Second attempt: mklink /d “.\shared_files” ....\my-app-public\src\shared_files worked fine.
Upvotes: 0
Reputation: 1
I had the same issue. You have to make sure the Source folder does not already exist. (if it does , then rename it to something else)
In case of below Backup folder should not exist under MobileSync. Since Apple iTunes looks for Backup folder with that name, just rename the existing folder to something like OriginalBackup to avoid iTunes from finding it. Instead the mklink will synonym Backup to D: folder as below
mklink /J C:\Users\Dell\Apple\MobileSync\Backup D:\Apple\Backup\iPhoneXRBackup
Upvotes: 0
Reputation: 1
I did this for Google Picasa so I could access photographs on more than one machine. It works very well as Picasa is not really a netowrk enabled program. For me I did the following:
Run the following commands from an elevated cmd prompt:
mklink /D "c:\Users\\AppData\Local\Google\Picasa2" "o:\PicasaDatabase\Picasa2"
mklink /D "c:\Users\\AppData\Local\Google\Picasa2Albums" "o:\PicasaDatabase\Picasa2Albums"
Two symbolic links will have been created in the source location and they will point to the network drive.
Obviously using symbolic links like this is a workaround for application that are not networkable and only one user can access the database at once.
Upvotes: 0
Reputation: 211
Here is how that worked for me.
I wanted to relocate my C:\ProgramData\Package Cache
to F:
partition.
Steps I had to do:
Physically move "C:\ProgramData\Package Cache"
to F:
. Now I had "F:\ProgramData\Package Cache"
and "C:\ProgramData\Package Cache"
is gone since I moved it.
In cmd run (all in one line, split here for readability)
mklink /J "C:\ProgramData\Package Cache"
"F:\ProgramData\Package Cache"
Result:
Junction created for C:\ProgramData\Package Cache <<===>>
F:\ProgramData\Package Cache`
Upvotes: 21
Reputation: 4686
The correct usage is:
MKLINK [options] {link} {target}
You're creating a link, so the link
is the new link you're about to create.
And the target
is the link's target, which is the existing directory.
Upvotes: 43