I am trying to create a symbolic link on my win7 64bit machine to redirect the iTunes backup data to another drive. I am pretty sure the syntax is correct but cannot understand how to clear this error. I have tried both commands below which have the same error. I am running in Administrator Command Window. Could there be some corporate group policy preventing me from running this command?

mklink /D "C:\Users\odellt1\AppData\Roaming\Apple Computer\MobileSync\Backup" "E:\Apple Computer\MobileSync\Backup" 

or

mklink /J "C:\Users\odellt1\AppData\Roaming\Apple Computer\MobileSync\Backup" "E:\Apple Computer\MobileSync\Backup"

Error

Cannot create a file when that file already exists.

migrated from stackoverflow.com May 20 '13 at 6:03

This question came from our site for professional and enthusiast programmers.

  • which one is the original directory? – Akram Berkawy May 1 '13 at 20:55
  • the original directory is C:\Users\odellt1\AppData\Roaming\Apple Computer\MobileSync\Backup – ChiliYago May 1 '13 at 21:39
  • Does the folder you're linking to on the E drive exist? Does a folder of the same name as the link exist on the C drive? Is the E drive formatted in NTFS? – Harry Johnston May 3 '13 at 5:36
  • The syntax is correct, before running this command, perform the following steps. Move all the contents of current mobilesync backup folder to E:\Apple Computer\MobileSync\Backup. Once done, delete the empty backup subfolder from "C:\Users\odellt1\AppData\Roaming\Apple Computer\MobileSync". A Junction can only be created if a subfolder with the same name does not exist at the location. – Karanvir Kang Sep 21 '17 at 12:55
up vote 23 down vote accepted

the syntax is incorrect. mklink has the following synatx:

mklink [options] <Link> <Target>

Target is the file/folder that exists, and Link is the created one that links to the target.

so the command should be:

mklink /D "E:\Apple Computer\MobileSync\Backup"  "C:\Users\odellt1\AppData\Roaming\Apple Computer\MobileSync\Backup"

see this link for mklink usage.

  • I have gone through the docs and being so brief you would think it would be no problem to run. However no luck, even reversing the link/target like you suggest results in the same error message. – ChiliYago May 1 '13 at 21:39
  • 1
    then you should check that E:\Apple Computer\MobileSync\Backup folder does not exists – Akram Berkawy May 2 '13 at 9:50
  • That worked. I noticed that deleting the full path resulted in error: "The system cannot find the path specified." So I restored the path and deleted only the last folder in the path (Backup) and then it worked. – ChiliYago May 3 '13 at 21:27
  • 1
    This is not the correct answer. This creates a simlink, which does not redirect iTunes to another drive. It does the exact opposite - it directs another drive to the iTunes backup folder. – Vaiden Mar 30 '17 at 15:04

The simply way is delete the Backup folder in Original apple folder backup (in C:\ driver) When we run the command:

mklink /J "%APPDATA%\Apple Computer\MobileSync\Backup" "E:\iTune Backups"

windows will create a link shortcut Backup in C:\ driver.

  • This is the correct answer which does what OP meant to do – Vaiden Mar 30 '17 at 15:06

I had the same issue with the "file already exist error", until I used the "%AppData%':

mklink /J "%APPDATA%\Apple Computer\MobileSync\Backup" "E:\iTune Backups"

Junction created for C:\Users\Me\AppData\Roaming\Apple Computer\MobileSync\Backup <<===>> E:\iTune Backups

Note: Make sure you use straight quotes, otherwise you get a syntax command error.

  • I like this simple method making sure the source and target folders are not present before creating the junction. Creating the junction creates the source folder, but not the target folder. So I had to manually create the target folder and then all is functioning as expected. – timoto May 13 '16 at 23:43
  • This fixed it for me but would be nice to have an explanation as to why the %AppData% fixes it. – Aureis Oct 10 '16 at 0:49

I just wanted to add that the error you mentioned in your comment above System cannot find the path specified appears to happen when you are symbolically linking at a folder sub-level which doesn't exist at the link's original source.

Meaning you can't link

"c:\program files (x86)\some folder1\some folder2\"

to target

"d:\programs\some folder1\some folder2\"

It will not work unless at least

"c:\program files (x86)\some folder1"

exists as part of the link source. You would have to either link

"c:\program files (x86)\some folder1"

to

"g:\programs\some folder1" 

or you would have to create at least an empty folder at

"c:\program files (x86)\some folder1"

and then create the link

"c:\program files (x86)\some folder1\some folder2" 

to

"g:\programs\some folder1\some folder2"
  • This seems like a bug on Microsoft's part, but this answer is actually correct. When you link C:\foo to E:` for instance, E:\foo` must exist to cd into C:\foo; however, when you do cd, you're placed into E:` -- **not** E:\foo`. Thanks for pointing this out, I would have never figured it out. – Qix Aug 12 '14 at 17:42

protected by Community Nov 15 '15 at 15:03

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.