HOWTO: Move your iTunes music while preserving library data (when you don’t let iTunes manage your music library)
It all depends on whether or not you let iTunes manage your music library:
- If you do, then moving your music while preserving library data (playlists, play counts, etc.) is pretty trivial and documentation provided by Apple has got you covered (check “Part 1” in the guide that follows).
- If you don’t (which is the user group I belong to), things are a bit harder, and instructions on the Internet are pretty rare to find (took a lot of Googlin’). It’s basically a two-part process.
Before we begin, let me state the obvious—keep backups (besides your music, don’t forget the library files—XML, ITL, etc.), more than one if possible. If after following my instructions something goes wrong and your music files and/or library are messed up, I shouldn’t be held responsible. Follow the instructions at your own risk, etc. For what it’s worth, I did what I’m describing here a couple of days ago and it worked without a hitch.
UPDATE: It’s also important to note that this definitely works with iTunes 6 (the version that was current when writing this HOWTO). Numerous reports in the comments though, indicate that it also works with versions 7,8 and 9.
So, with this out of the way:
Music that you rip with iTunes is imported in the iTunes Music folder—that’s usually C:\Documents and Settings\Username\My Documents\My Music\iTunes\iTunes Music\. Same goes for podcasts that you download with iTunes (look for a folder named Podcasts in the aforementioned path. Here’s what you have to do to move those files:
- Go to Edit → Preferences → Advanced → General. Click Change and choose a new path for your files—e.g. D:\Music\iTunes\.
- Quit iTunes.
- Open the iTunes Music folder, select everything in there (try a Ctrl+A) and copy it to the new location. As the “Help” page notes: “Do not drag the entire iTunes Music folder, only its contents.”
- Restart iTunes and your moved tunes are automagically found.
If you let iTunes manage your music library (in Edit → Preferences → Advanced → General, the box “Copy files to iTunes Music folder when adding to library” is checked √) with the aforementioned method you’ve moved your whole library, so you can stop reading here.
You’ve moved your iTunes podcasts and iTunes rips but what happens with the rest of your music that you have indexed with iTunes?
First, a note. In C:\Documents and Settings\Username\My Documents\My Music\iTunes\ there are two important files (among other stuff):
- iTunes Library.itl
- iTunes Music Library.xml
If you open the former with a text editor, you’ll just see garbage (not human-readable characters) so there’s nothing we can do with it. If you open the latter, you’ll see a nicely formatted XML file with references to the file paths for each of your music files.
You may wonder: “why not move my music to the new location, edit the XML file to reflect the new paths, launch iTunes and go?” Because iTunes doesn’t actually read this file—it’s using the ITL file (which we can’t edit accordingly).
But as Schmolle found out… if the ITL file is corrupted or damaged, then iTunes will revert to the XML file in order to rebuild it (and consequently, your library data). So the plan is to edit the XML file to reflect the changes in our file paths, and somehow damage the ITL file in order to get iTunes to rebuild it from our revised XML file. If this sounded a bit complicated, worry not—we describe the actions needed step-by-step below:
- Quit iTunes.
- Backup your iTunes Music folder—this contains your library data. Now that it’s relieved from your podcasts and iTunes rips it’s considerably lighter too, so do an additional backup or two just to be on the safe side. Do this. Now.
- Move your music files (those indexed by iTunes that are neither iTunes podcasts nor iTunes rips) from the old location (say, C:\Documents and Settings\Username\My Documents\My Music\Non-iTunes\) to the new location (say, D:\Music\Non-iTunes\).
- Open the “iTunes Library.itl” file. Select all text (Ctrl+A) and delete it. The file is now blank, with zero characters on it—save it. iTunes Library.itl’s filesize should now be 0 bytes. (This is important, as Schmolle notes, because some Unicode-aware editors—e.g. UltraEdit—may add invisible characters to the beginning of the file.)
- Open the “iTunes Music Library.xml” and do a global search and replace with your text editor of choice. (Search for the old path, and replace with the new path; a screenshot of how this is done in EditPad Lite, a freeware text editor that’s light and powerful, follows after the end of this list.)
- Save the XML file.
- Launch iTunes. A prompt with a progress bar will come up—iTunes is rebuilding your library. Depending on how powerful your computer is and the size of your music library, this may take a while. When this ends, iTunes will come up with a message saying that the library file was corrupted/damaged and it tried to rebuild things for you. Press “OK”, iTunes finally launches.
- Check to see if all your music and playlists are there, and if library data (play counts, etc.) has been preserved. (Hopefully everything’s fine.) You’ll also notice a couple of additional static playlists for your podcasts, videos, etc. UPDATE: Simon notes in the comments section:
As a minor aside, this approach ‘loses’ the date and timestamp when the file was originally added. This instead becomes the date and time that the track was (re)added to the library during the rebuild. That said, while this slightly messes-up any ‘recently added’ playlists, it somehow maintains the correct sequence (i.e. the rebuild seems to occur in the same sequence in which the mp3s were originally added, so one can still sort the library/playlist by ‘date file added’ and see the newest ones at the bottom).
- You’re almost done.
(EditPad Lite screenshot—click for larger size:)
By almost we mean:
- all the columns in iTunes have been resetted. You’ll have to re-select those columns that you want to be viewable for each playlist, and resize them if necessary.
- your podcast subscriptions have been lost. Do the following:
- Go to Edit → Preferences → General and see that “Show Genre when browsing” is checked √). Press the “OK” button.
- Choose Edit → Show Browser.
- Go to your Library. From the first column of the browser (the Genre one), choose “Podcast”. In the third column of the browser (Album) those albums you see are the podcasts you were subscribed to do. Click on each “album” (podcast), choose all of its “songs” (the podcast’s shows), and drag them to Podcasts in the Source column—see screenshot after the end of this list.
- Go to Podcasts, you’ll now see a collapsed entry for the podcast you just dragged and next to it a “Subscribe” button—click on it to re-subscribe to this podcast. (If you click the arrow to expand the entry you’ll see that all of the podcast’s shows that you dragged from the Library are there.)
- Repeat process for each podcast you want to re-subscribe to.
(Screenshot that shows how to move podcasts from the Library view to Podcasts—click for larger size:)
You’re done, that’s pretty much it.
Thanks to Schmolle—without his findings I’d have probably never figured that out. I just brought his guide a bit up-to-date, and added Part 1 and the podcasts section.
If you’re on a Mac, the process should be similar except your “iTunes Library.itl” file is simply “iTunes Library” (without an extension). (UPDATE: Rich confirms that it works.)
For those switching to Mac and wanting to carry their music and library data over, I’d like to know if the following works (i.e. AFAIK nobody’s tested this):
- blanking your “iTunes Library” file (on the Mac)
- bringing over your “iTunes Music Library.xml” (from the PC) revised with the updated filepaths (for the Mac)
Finally, if you want to move your music from a “traditional” hard drive to a NAS (network attached storage) device, you may also want to read Simon’s comment.
If you try it, let me know how it went. Furthermore, if you’ve got anything to add, or feel like sharing a relevant tip or two, leave a comment.
- (June 27th, 2006) Added notes on NAS devices, lost “date added” timestamps.
- (March 14th, 2008) Does the rebuilbing of the ITL file stuck? Do you have songs with Japanese/Chinese characters? If you answered “yes” to both questions, read llyse’s comment.