32

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.

| improve this question | |
  • 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
  • 1
    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
37

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.

| |
  • 1
    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
  • 1
    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
13

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.

| improve this answer | |
4

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.

| improve this answer | |
  • 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
3

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"
| improve this answer | |
  • 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 - MONICA WAS MISTREATED Aug 12 '14 at 17:42
0

Ransomware Protection can also cause this when you have "Controlled Folder Access" enabled.

  1. Press the Windows Key (or click the Start Menu)
  2. Start typing "Ransomware"
  3. Open "Ransomware Protection"
  4. Click "Block History"
  5. Click to expand the most recent item (assuming you've just got the error)
  6. Click "Yes" on the UAC (User Account Control) dialog that pops up
  7. Confirm the app (e.g. cmd.exe) and "Protected folder" listed
  8. Click "Actions" and choose "Allow on device"
  9. Re-run the command
| improve this answer | |

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