I am trying to create a symbolic link on my Windows 10 64bit to redirect the iTunes backup file to my external hard disk (D:\)
This is the link I added in my command window:
mklink /J "%APPDATA%\Apple Computer\MobileSync\Backup" "D:\iTunes Backup"It didn't work fully as the backup file was still created in the parent directory (C:\) even though the same file was also created in D:\
Now I can't complete my phone backup because I do not have enough storage.
Why were two files created ?
1 Answer
Why were two files created?
mklink /J "%APPDATA%\Apple Computer\MobileSync\Backup" "D:\iTunes Backup"The above command is broken. The syntax for mklink is:
MKLINK [[/D] | [/H] | [/J]] Link Targetwhere link is the "The new symbolic link name", so not the name of a directory including the full path.
In addition, you can't make a link where the name already exists.
If you were in directory "%APPDATA%\Apple Computer\MobileSync" and you tried the command:
mklink /J Backup "D:\iTunes Backup"Then you would have received an error:
Cannot create a file when that file already exists
Note the error message says a file already exist instead of a folder. This is because the system sees links as shortcuts (files) and not as folders.
How do I redirect the iTunes backup file to my external hard disk?
Use the following procedure:
Create
D:\iTunes Backupif it doesn't exist. Now you have a target for the junction:md D:\iTunes BackupGo to the existing backup directory:
cd "%APPDATA%\Apple Computer\MobileSync\Backup"Move any existing files to
D:\iTunes Backup:move * "D:\iTunes Backup"If there are any folders move those as well.
Go up one directory to
"%APPDATA%\Apple Computer\MobileSync\:cd ..Delete the backup directory:
rd BackupCreate the junction:
mklink Backup "D:\iTunes Backup"You should see a message like:
Junction created for Backup <<===>> D:\iTunes Backup
Further Reading
- An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
- mklink - Create a symbolic link to a directory or a file, or create a hard file link or directory junction.