In any good tutorial related to moving iTunes playlists and libraries from Point A to Point Z you’ll see some mention of iTunes’ library files—specifically, the iTunes Library and iTunes Music Library.xml files. On the Mac these files are stored at this location: youruserfolder/Music/iTunes. Swell, but what purpose do these files serve? It’s like this:
The iTunes Library file is a database of your iTunes media and playlists. It doesn’t hold the media—audio and video files are stored, by default, in the iTunes Music folder within the iTunes folder. Rather, it contains information about the media such as the contents of playlists, song ratings, and play counts. This file is used only by iTunes.
If you move it from its default location, iTunes creates a new iTunes Library file when it’s next launched. When it does so, you’ll wind up with an empty iTunes library because iTunes no longer has a record of your media. The media is exactly where you left it—in that iTunes Music folder, by default—but the iTunes Library file won’t know about it until you add your media to iTunes. For this reason, you’ll often find that tutorials suggest that before mucking with the location of your iTunes library you create a backup of this file. Should something go wrong, you can restore your library to its previous state by using the backup copy of the iTunes Library file instead of the one most recently created by iTunes.
The iTunes Music Library.xml file contains some of this same information—the contents of playlists, for example. However, it exists, in large part, to make the contents of your iTunes Library known to other applications. For example, when you open iPhoto and create a slideshow, you have the option to accompany that slideshow with a track or playlist from iTunes. The iTunes Music Library.xml file is responsible for this kind of interaction by letting other applications know about the contents of your iTunes library. If you quit iTunes, move this file, and relaunch iTunes you’ll discover that your iTunes library is unchanged—only moving the iTunes Library file causes the contents of your iTunes library to disappear.
iTunes offers the option to create your own .xml files for playlists and your iTunes library. For example, if you’d like to create a backup .xml file for a single playlist, select a playlist in iTunes’ Source list and choose File -> Export and in the Save dialog box that appears you’ll see the name of the playlist followed by .xml. (Within the Format pop-up menu you can also choose Plain Text or Unicode Text.) You can then import that .xml file into another copy of iTunes (or your original copy of iTunes if you’ve lost that playlist) using the File -> Import command. Similarly you can export the entire iTunes library by choosing File -> Export Library. Again, this doesn’t export the media files, rather just the record of the library’s contents.