Is the size of your iTunes music library starting to overwhelm your C: drive? Do you want to make your iTunes music library available to more than one PC over a network?
This post is about how to move all the files in your iTunes Music Library (including music, podcasts, videos, TV shows and audio books) from your PC’s drive to a network drive (or another drive on the same PC) while retaining both: (i) the integrity of the underlying file names and organization structures; and (ii) playlists, play counts, ratings etc.
This post is for the gear-head types like myself. Those that have spent time ‘under the hood’ organizing their music the way they want – naming the underlying files with names of their choice, organizing the files into directories of their choice, etc.
If you are like most people and let iTunes do its own thing (ie: let iTunes handle file naming and organization), this post is not for you. There are much easier ways to move your files if you let iTunes do this it’s way. See, for example, here, here and here.
First PMP – The Creative Nomad: My first portable music player was a 32 Meg (yes, Meg, not Gig) Creative Nomad. I organized my music at that time with Windows Media player (‘WMP’).
Dale’s Early Music Organization: Over the years, I spent an enormous amount of time and energy ripping songs from my CDs, keeping my underlying music library file names, file organization/directory structures and meta data pristine. All the files were contained under my C:\Files\MP3 hierarchy, making it very easy to back up my media from time to time by simply backing up that directory.
Song Centric vs. Album Centric: One of the reasons I gravitated to portable music was that it freed me from the ‘album centric’ listening paradigm. That is, I much prefer listening to individual songs rather than entire albums where I typically enjoyed just a song or two.
The Playlists: Because I rarely ripped entire albums, I developed a large number of playlists – about 100 organized into folders and sub-folders (see picture). Each playlist typically has 50 to a couple hundred songs in it. This is how I listen to music. If I’m in an upbeat mood, I play an upbeat playlist like my “Pop – Hip Hop” playlist. If I’m working or studying I might may play my “Classical – Baroque” play list.
iPod and iTunes: A few years ago I purchased an iPod and abandoned WMP. This was a big decision because at the time there was no tool to migrate my extensive set of playlists to iTunes. Fortunately, I had meticulously edited the meta-data in my underlying files. So, importing the music into iTunes resulted in proper indexing by song, artist, album, genre etc. But, I had to spend SEVERAL painstaking weekends recreating my playlists, song by song (thousands of them), within iTunes. This was NOT so much fun. I will NEVER do that again.
The First Problem
Video Podcasts Take Over: My music library has grown over the years. Its size grew much larger and much faster after I purchased AppleTV and started downloading and retaining a large number of SD and HD video podcasts (for example I subscribed to the 200+ available Ted Talks). My iTunes library has grown so much that it swallowed up my C: drive.
Drobo the Answer?: I purchased a Drobo earlier this year. I love it. It expands as my storage needs expand. I have hung it off my home network server, it is shared across the network and is mapped to the N:\ (for ‘N’etwork) drive on all of my PCs and laptops. It is also networked to my iMac.
To solve the space problem I decided to move my iTunes music library from my main PC’s hard drive to the Drobo. This will allow me to expand my iTunes media library to my hearts content. This will also allow me to share my iTunes media library with any other PC or Mac on my network.
The Next Problem
The ‘Apple Way’: iTunes has a pretty straight-forward solution to moving the iTunes Music library to an external PC. You can read about it here, here and here. The problem is, this comes at a HUGE price for me.
My Way: Let’s step back for a moment. Back around the year 2000, memory in portable music devices was limited, as were hard drive sizes. As such, I historically only ripped the songs from albums that I liked the most (not entire albums).
Every single song in my file library is now named with this convention:
artist – song name.mp3 (example: ‘Aqua – Happy Boys & Girls.mp3’)
I do not include the album name in the file name for two reasons. Originally I wasn’t ripping entire albums. More importantly, one of the forces driving how I organized my MP3s was my dislike of the album format. I like to listen to songs, organized into thematic playlists, not albums. I do not include the track number in an MP’s file name for the same reason. A track number is relevant only to people playing albums.
All of my ‘singles’, are contained in one huge directory. It makes no sense to organize my couple thousand ‘singles’ into a directory structure based on artists or albums when there would be only one file in most of those directories. In this way I can find and access any song quickly by sorting my single MP3 directory by artist name.
As portable music device memory grew and hard drives got cheaper, I did go back and re-rip the entirety of most of my albums. The thinking was, why not? Memory is so cheap I might as well. I also took that opportunity to re-rip my music collection into higher bit rates (typically 256 kbps VBR)
I also assiduously included the album name in the meta-data should I ever actually want to access and listen to music by album in the future (which, with cover flow on iTunes, AppleTV and the iPhone, I actually now do sometimes).
But I still rarely listen to those albums. I almost always listen to my playlists.
The Problem with the ‘Apple Way’: In order to migrate my library the “Apple Way”, I would loose all the organization I describe above. When you move a library the ‘Apple Way’, you must be willing to allow iTunes to ‘consolidate’ your library and ‘Keep [the] iTunes Music folder Organized’ in the manner it chooses. This results in two very bad things for me:
- Forced File Renaming: iTunes renames every single .mp3 file into a format I do not want, namely:
‘track number – song name.mp3’
- Forced Restructuring: iTunes places all such renamed files into, in my case, some thousands of folders and subfolders, with the artist name being the name of the lower folder and the album name being the name of the sub folder.
Think about this for a moment. Most of my music is one-off songs. Most of these newly created folders would have just one song located two folders down, with the track number and the song name identifying the song. How lame is this?
Again, if you are the type that lets iTunes organize all your music and you never ‘look under the hood’, you aren’t going to care. But I do care. I not only want to manage my media library at the file level (and often do), I want the freedom to leave iTunes some day, with files organized how I want, when a better music playing service comes along.
In short, I want to control my files, my way, not the Apple way.
An Unpalatable Solution
Aside from the solution I describe below, the only other way I could find to solve my problem would have been to move my music library to the Drobo, clear my iTunes library entirely, re-import it all, and then spend weeks manually recreating my playlists. Sorry, but that’s too much work. Been there, done that.
After many, many frustrating hours, thanks to Rob Garret in this post, I found a solution that allowed me to move my music library to my Drobo while retaining my file names and organization structures with all my playlists remaining fully functioning.
Summary: The answer lies in: (i) editing the key .XML file (see below) so that all MP3 file references point to the new file locations; and (ii) purposefully corrupting the key .ITL file (see below) such that it is forced to rebuild itself from the edited .XML file.
Understand the Risks: Review my ‘Casualties’ section below before you begin so you know what you might loose by doing this.
The iTunes File Structure: To understand the solution you need to understand the two key files. iTunes manages your music library, play lists, ratings, play counts etc. in this file:
iTunes Library.itl (the ‘.ITL file’)
This .ITL file is a binary file that cannot be directly edited. Almost all of the information in the .ITL file is, however, replicated this companion XML file:
iTunes Media Library.xml (the ‘.XML file’)
[May 27, 2010 Update: Somewhere along the line since I first wrote this post, iTunes changed the .XML filename to iTunes Music Library.xml]
In Windows 7 these files are typically located in:
In Vista these files are typically located in:
in XP these files are located in:
C:\Documents and Settings\username\My Documents\My Music\
Change Your ‘iTunes Music folder Location’: Under the ‘Advanced’ tab under the ‘Files –> Preferences’ menu, change the ‘iTunes Music Folder location’ field to your target directory. You can see in the picture below that I changed it to ‘N:\media\iTunes’.
Important Note 1: This will not immediately result in the any files being moved. It tells iTunes where all the media files will be moved to shortly. It also tells iTunes that all media files (such as music or podcast downloads) should be placed there in the future.
Important Note 2: DO NOT CHECK the ‘Keep iTunes Music folder organized’ check box. If it is checked, it should be unchecked. Checking it will defeat the entire point of this tutorial.
Close iTunes: iTunes must not be running for the next while.
Backup Before the Key Library Files: Before doing anything else, backup both the iTunes .ITL file and the .XML file to a safe place. If you make a mistake or disaster strikes, you can use the backups to recover (see recovery instructions below).
Copy Your Underlying Media to the New Location: Copy your underlying media (all your .mp3, .aac, .mov, .mp3 etc. files) to the location you want them (in my case a network drive), within a directory structure that corresponds with their current structure. In my case, this meant I copied everything in the:
directory to my
directory. Note that under myMP3 directory, I had thousands of MP3 files and dozens of subfolders including subfolders for my podcasts, movies, TV shows etc.
Important Assumption: This tutorial assumes that before you start, all of your media is organized under a single hierarchy structure somewhere on your C:\ drive like mine is under C:\files\MP3 and its subdirectories. If your music is scattered across your hard drive, this tutorial won’t work for you.
Important Note 1: Your entire music structure needs to be copied as it is. The resulting underlying structure on your network drive, needs to remain EXACTLY the same as it was on your C:\ drive, or this won’t work.
Important Note 2: I strongly suggest you COPY your media to the network drive and not just MOVE it there. If something goes wrong, you’ll want the source files for recovery purposes (see below). If, after sufficient time has passed and everything is working from the new location, you can then delete the source files to clear up space on your C:\ drive.
Edit the .XML File (‘iTunes Media Library.xml’ or as iTunes subsequently renamed the file since I originally wrote this post, the iTunes Music Library.xml file): This is the only quasi-challenging part of this process. Open the .XML file in any XML file editor (I used Dreamweaver) or any text editor capable of handling large files. Vista’s/Windows 7 WordPad, depicted in the picture below, works too.
The .XML file contains a link to each underlying piece of content (all your MP3s, MPegs, AACs etc) in your iTunes library. For example, this is how the originating link to Barry White’s ‘Your the First’ song looked in my original .XML file:
You need to edit the .XML file to change all such link references to the point to the new library location. In my example, we want this link to be changed to:
This requires using your editor to search for and replace every instance of original library location to the desired destination folder. In my case that means replacing every instance of ‘C:/files/MP3’ with ‘N:/media/iTunes’ in the .XML file.
Given the size of the .XML file, depending on the speed of your computer this could be done in seconds or may take up to 10 or more minutes to complete.
When done, save the .XML file to the same name (‘iTunes Media Library.xml’ or as iTunes subsequently renamed the file since I originally wrote this post, to the iTunes Music Library.xml file) and the same location as it was on the C:/ drive.
Note 1: Neither the .ITL file nor the .XML file ever get moved to the new directory where the underlying media is being moved. They stay on the C:\ drive where they always were.
Note 2: Unless you have a very small .XML file, do not use Notepad. It is not designed for editing large files. It will likely crash.
Note 3: As noted by Dave in the comments below, using Microsoft Word is not recommended, though I suspect it could work if you forced it to save in Plain Text (.txt) format. [Update: Note 3 added May 27, 2009]
Edit / Zero Out the .ITL File (‘iTunes Library.itl’): This is the key step to this whole post. The ‘iTunes Library.itl’ is not directly editable. If it were, we would have edited it instead of the XML file. What we need to do here is create a corrupted version of the .ITL file. When you do, the next time you start iTunes, it will notice that the .ITL file is corrupted and will recover it from the newly edited .XML file. The result – a circuitously edited .ITL file with all its internal pointers, pointing to your newly located media library directory.
To empty / zero out the .ITL file:
- Open the file with the same editor you used to edit the .XML file. You’ll see a screen full of gibberish.
- Delete everything in the file. In most editors pressing Ctrl-A will select everything in the file. When everything is selected, press Delete.
- Save the .ITL file to the same file name (‘iTunes Library.itl’) at the same file location.
That’s it! Your work is done. The rest is up to iTunes.
Rebuilding the .ITL File
Assuming you have:
- copied your music files to the new location;
- edited the .XML and ITL Files; and
- saved them back to their original locations;
the next time you start iTunes, it will automatically rebuild the zeroed out .ITL file by importing all the needed information from the .XML file. This took about 10 minutes for my 4,800 files.
Along the way you’ll get an error message (not shown) telling you the library had been corrupted and had to be rebuilt. You’ll need to acknowledge that message (by clicking ‘OK’ if I remember correctly) before the process will proceed.
iTunes will next recreate your artwork thumbnails. That took about 5 minutes.
You’ll then see iTunes go through its ‘Determining Gapless Playback Information’ process with all your files. This took about 10 minutes.
Once that is complete, you’re entire iTunes media library will have been moved, your file names and organization will have remained intact and you will also have retained all your playlists, play counts, ratings etc.
Good job! Pat yourself on the back!
Two Minor Casualties
- iPhone Apps Wiped: I’m not sure why, but, along the way about 60% of my iPhone Apps were wiped from iTunes. They did not restore from the iPhone on the next sync as I had hoped. I could not see any rhyme or reason as to which were gone and which remained. Their .ipa files were, however, still in my C:\ drive at this location (in Vista):
I simply dragged and dropped the .ipa files onto iTunes to get them back. They synced back to my iPhone without issue.
No big deal except that one app was somewhat data-centric. I lost about an hour’s worth of data.
- Some Cover-Art Lost: I lost about 5% of my cover-flow art. It didn’t take long to recover the art. If this happens to you, you can easily recover most, if not all, album cover art as follows:
- In iTunes, sort your library by album
- Successively select all the songs in for each album without cover art
- Right click on each highlighted group of songs from a given album
- Left click on the ‘Get Album Artwork’ option
That’s pretty much it. iTunes should find and replace most, if not all, cover art that way.
Recovery if Something Goes Wrong
So long as you followed my instructions above (backed up key library files and kept a copy of source files in their original location), if something goes wrong recovery is simple. It won’t take more than a minute
To recover, all you need to do is:
- close iTunes; and
- restore the backed-up .itl file and .xml file to their original locations
That’s it. When you next start iTunes, all should be as it was before you started this process
Note: Restoring the original backed up .ITL and .XML files necessarily results in your overwriting the newly created versions of those files. You might wish to back up the newly created versions before recovery if you want to switch between the old and new setups for testing purposes.
Notes on my Setup
- iTunes v. 8.02.20. This is the version of iTunes I used when I wrote this tutorial.
- Vista x64 with no UAC: I use Vista x64. The PC OS shouldn’t make a difference except for the locations of the key .ITL and .XML library files (see above). You may or may not have permissions to access or edit those files. I have Vista’s UAC shut off. You may need to shut it off first and/or work in administrator mode.
- No DRM: None of my music files are encumbered by DRM. 100% of my music files are .MP3 files. This process should work for DRM’d AAC or other files too, so long as they are still being played on an appropriately accredited PC/Mac. But I haven’t verified this point.