Ben Ward

Migrating an iTunes Library

. Updated: .

Go go lazyweb!

Here’s the deal: I usually use my PC to listen to music but having just moved back home, there’s no room to set it up. Therefore I’ve instead copied a small subset of that music onto my iBook and will be using that instead for the next few months – iPod syncing et al.

This is great, but just copying the files over causes me to lose ratings and play counts, which are in turn vital for the Smart Playlists that are used to fill my iPod.

Both my iTunes/Win and iTunes/Mac music libraries were set to have the music organised by iTunes, therefore the music has the same names and subdirectory structure on both machines. The difference is just the location of the library: file://localhost/D:/All%20Users/Music/ on the PC and file://localhost/benward/Music/iTunes/iTunes%20Music/ on the Mac.

Now, I’ve had suggestions of mirroring the entire PC Library onto the Mac and then just trimming out the music I don’t want, but there isn’t enough disc space. Nor is there enough disc space on the PC the mirror it locally, trim it and then migrate the whole lot to the Mac.

My attempted solution has been to copy ‘iTunes Music Library.xml’ file from the PC to the iBook and use Find+Replace to change the paths to the files. If this worked it would leave about 3000 dead tracks in my iBook Library, but I suspect that can be cleaned up with a script afterwards.

Trouble is, find and replace doesn’t work. I amend the PC library’s paths, delete the iTunes library files and place the modified XML in the Mac’s iTunes Music directory. Restarting iTunes opens with an empty default Library, replacing my hacked version.

So, does anyone understand the iTunes XML PList better than me and fancy a guess at the hacking required to migrate it?

Thanks.

Comments

Previously, I hosted responses and commentary from readers directly on this site, but have decided not to any more. All previous comments and pingbacks are included here, but to post further responses, please refer me to a post on your own blog or other network. See instructions and recommendations of ways to do this.

  1. Ok… I’ll try to explain again.

    The full mirror thing is what we, in the industry of techmologies call a ‘backup in case Ben breaks things and cries with the waa-waa-waaing’.

    With that in mind:

    1. On the PC, trim down your iTunes library to what you wanna keep in iTunes.
    2. Close iTunes everywhere, ever
    3. Then do the find and replace dance you mentioned.
    4. Copy all files to iBook, including iTunes Music Library.xml and iTunes Library.itl, but not to ~/Music/[blah]. Do not delete the files from the PC just in case of jam/coke/flaming iBook disc rapists
    5. Find the equivalent of iTunes Library.itl on the iBook, and rename the copied-from-PC iTunes # Library.itl to match.
    6. Move the copied-from-PC files to the appropriate place (library files in ~/Music/iTunes/, but I’m not certain – depends where they may be in the PC…)
    7. Open iTunes and hope.

    If this doesn’t work, then I dunno. I think this worked for me. Or it didn’t, and I simply did the ‘import XML’ thing after copying the files across and putting them where I wanted ‘em, but didn’t worry about losing playcounts and ratings. I forget which. I think it may have been the former, but a knowledge of iTunes suggests the latter.

  2. Ben,
    You need to empty the .itl file too (i.e. open it up and delete the contents, then save it again) – that will make iTunes think its corrupt, then will rebuild from your edited .xml.

    There’s a load more info at http://hifiblog.com/past/2006/05/11/howto-move-your-itunes-music-while-preserving-library-data-when-you-dont-let-itunes-manage-your-music-library/ and it’s just worked for me – I’ll write it up and let you know when I’ve posted the method on my blog.

    HTH, Mark

  3. Ben

    Steve: Thanks. My previous failures came from not including the ITL file, or more specifically as Mark enlightens, I started iTunes up with just an XML file, no ITL at all. That cause it to reset to default. The the self-corrupted ITL as Mark suggested iTunes went into restoration mode and seems to have imported everything as I’d hope it would.

    Thank you very much both. I can finally sync my iPod again!

    Ben

  4. gr

    Um.

    Is there something wrong with doing File -> Import on the iBook side?

    That’s what it’s there for. Just import the xml file from you PC, and it will go put things in the right place. Oh.. and you want to import the XML file produced by File -> Export Library, not necessarily the one you scrounged out manually.

    I just did this (granted, between a PowerBook G4 and a MacBook Pro, both running Mac OS X) and it worked like a charm. The only down side was dupes of all the iTunes-provided smart playlists, so I just ditched the lot of those.

You can file issues or provide corrections: View Source on Github. Contributor credits.