Move iTunes Library

Posted: March 23, 2012 in Uncategorized
Tags: , ,

I found a few of these tutorials but none quite so thorough as I needed.

Update: This is a lot simpler with Windows 7 (and Vista too, probably), and makes this entire article redundant.  Just choose a new location for your Music folder. Browse to C:\Users\[yourname] and right click on Music, click Properties, click the Location tab, click the Move button, choose a new location (eg. D:\Data\Music) and click Ok, Apply, etc. Say “Yes” when asked to move your files.


There are two ways; the iTunes way, using its “iTunes Media folder” method, and the “junction” method.

The “iTunes media folder” method is a setting you can change for where to store the actual media files. It’s is only good for specifying which drive takes the brunt of the storage… it won’t preserve your entire library. If you were to re-install windows (or re-image using Norton Ghost), those media files will be useless. None of the library information is preserved, even your playlists will be gone. You can re-create your library, but the process is risky because there are so many points of failure – you can lose all your playlists, or have to re-import all your music, which takes a long time.

The “junction” method is so simple. It simply re-directs the main iTunes Library folder to another location – that’s the folder that has your library information, such as playlists, playcounts, AND media. It’s a windows tool called “junction” which can make a fake folder that actually points to a different drive. It’s essentially one step, but the instructions below are about making that junction – you need to get your source folder and target folder correct, that’s where most of the steps come from. This only has ONE point of failure – and it’s not serious – if you get it wrong, your library doesn’t show up. Fix it, and it shows up. Simple.

I provide both methods below, because the “iTunes Media folder” instructions contain useful information that may come in handy if you find yourself in a scrape due to other extraneous factors. But, the “junction” method is the recommended one. Here we go…

Before you do anything below, backup your library info just in case. Go to File, Library, Export Library, and save it somewhere safe. This contains your extra song info, eg. there is a section in it called Playlists. If something goes wrong, you can always recover your playlists and song information, even if you need to do some dexterous “find and replace” exercises to do so. (The “iTunes Media folder” section below will give you an idea of how to do that, if necessary.)

Note: I consider it good practice to go into your iTunes settings, in the Advanced tab, and check the boxes “Keep my library organised” and “Copy songs into library when importing”.  This means that all your music will always be in the one place, and it will make moving the library around a hell of a lot easier, not to mention keep track of where all your space is going.

Moving iTunes library – iTunes Media folder setting

  1. Go to Preferences, Advanced, and set the new iTunes Media Folder
  2. Close iTunes
  3. Go to the iTunes library files, mine were at C:\Users\name\Music\iTunes
  4. Open “iTunes Library.itl” in notepad, select all, hit delete, save, and close. So you have an empty file.
  5. Open “iTunes Music Library.xml”. in notepad, and do a “find and replace” to change the old location to the new location. But before you hit “Replace all”, you MUST do the following with your destination path;
    1. Convert back slashes \ to forward slashes /
    2. Convert spaces to %20, eg. “iTunes%20Media”
  6. Replace all, and save & close the library file
  7. Open iTunes. It will say things need recovering, a few times, just hit OK every time, and your library will be re-built anew with the files in the new location.
Note: If you’ve been using iTunes for more than a year (as of Jan 2012) then it’s entirely likely your Library folder structure is a bit wacky.  Basically iTunes changed their folder structure.  They used to store their music in “My Music\iTunes\iTunes Music” but now they store it in “My Music\iTunes\iTunes Media\Music”.  Improvement is always good, but they chose not to clean up after themselves.  Even if you have “Keep my library organised” checked in the preferences, iTunes will consider it “good enough” to leave the music in the old structure the way it was, and just import new songs into the new structure.  So you’ll have two locations for your music under “My Music\iTunes”, and this will be reflected in the “iTunes Music Library.xml” file, because some song entries will point to one location and some the other.  And this is going to cause you a lot of headaches when trying to follow the instructions above, because you will have to do two lots of find&replace, and you will be better off attempting to merge the two folders yourself (and do an appropriate find&replace) to attempt to resolve this situation, although this is of course inherently risky.
That is another reason to use the junction method below.  You could leave it in the mess that it is in and move the entire folder without iTunes knowing any better.

Moving your iTunes Media folder – junction

One level above the “iTunes Media” folder is the “iTunes” folder, and it stores critical library information about the songs, including your playlists.

As described earlier, we’re using “junction” to create a fake “iTunes” folder that points the system to the real “iTunes” folder somewhere else. Really, this is the functionality that iTunes should provide, but it doesn’t, so here we go. It’s actually very straight forward.

  1. Download “junction
  2. Extract it to C:\Windows\System32
  3. Now you are going to copy the full path of your source iTunes folder, and paste it into an empty text document (notepad) for later. Eg.
  4. Now this iTunes folder can’t stay here anymore – it’s going to be replaced by a fake iTunes folder, so now is the time to move it to its final location. Move the iTunes folder and wait for it to finish transferring. (That means go up one level and cut the actual “iTunes” folder – do NOT leave an empty iTunes folder behind)
  5. Now copy the full path of the destination and paste it into the text document. eg.
  6. In your text document, surround the paths with “quotes” and precede the line with “junction -s” Your junction line should look something like this;
    junction -s "C:\Users\name\Music\iTunes" "D:\iTunes"
  7. Hit Start, Run, type “cmd” (without the quotes) and press enter. This is the command window. Copy your junction line and paste it here by right clicking in the command window and clicking “paste”.
  8. Press ENTER to run the junction command.
  9. If you get an error, go back and check you did everything correctly. And you’re pasting from a text file, it’s easy to make minor corrections without having to re-type the entire bloody line again.
    Otherwise, now you can start iTunes and it won’t know any different. Your entire library is in its new location, playlists and all, and iTunes thinks it’s still accessing a folder on C:

The only thing to remember is you will need to recreate this junction again if you format C: and re-install iTunes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s