4 Replies Latest reply: Apr 5, 2007 11:55 AM by Chris CA
Holy Smokes Level 1 Level 1

Any iTunes 7.x user who manages their own music library outside of the "iTunes Music" folder might be able to tell you that iTunes DOES NOT respond well after manually moving tracks from one place to another on their computer systems. In fact, any file you move becomes immediately unplayable in iTunes. And, if you're anything like I am, losing several years worth of song rating metadata and playlists is not a good incentive for change. However, one thing others might not be able to tell you is that there's an easy workaround for the problem and you get to keep your playlists, ratings and other info. Read on to learn about the workaround.

About the Workaround

The workaround is a simple hack I devised after recently transferring a good portion of my music library between hard disks and running into problems with iTunes. The fix steps provided below are intended to circumvent the problems with iTunes and give users the freedom to move songs and other media files on their computers while maintaining the integrity of both the ratings and the playlists. Meaning you won't need to manually update the song locations in iTunes one-at-a-time, which, at version 7.02 is the only way to accomplish this task using the program.

Please be aware that not all information is retained using this workaround. What will be lost are the following: the "Recently Added", "Recently Played" and "Top 25 Most Played" iTunes Smart Playlists; any media file play counts; last played information; and possibly some other data used only internally by iTunes.

So, if you're comfortable parting with some metadata while keeping your cherished song ratings and playlists intact during file relocation, read on to learn how to use the workaround.

Workaround Steps

The following instructions walk step-by-step through the process of this workaround.

Note: All backslashes used in file paths have been converted to forward slashes so that they will adhere with MySpace XSS security validation checks. These altered paths can still be copy/paste into Windows Vista's Explorer program once the Username is changed to the User Account where the iTunes files reside.

Preparing for the Move

Before you move your files, do the following:

1. Close iTunes.
2. Create a backup copy of the following files:

iTunes Library XML (iTunes Music Library.xml)
Note: Vista users can find the Library XML at C:/Users/Username/Music/iTunes

iTunes Music Database (iTunes Library.itl)
Note: Vista users can find the Music Database at C:/Users/Username/Music/iTunes

Moving Your Files

This part should be self explanatory, but while you do it make sure to note the following two things:

1. The path where the files were previously stored (e.g. D:/Music).
2. The path where the files will end up (e.g. E:/Music).

Execute the Fix

After your files are moved, complete the following steps to implement the fix.
Note: Do not open iTunes during this process.
Hack the iTunes Library XML

Once the files are moved the Library XML file locations will be out of sync. Follow the steps below to update them so that they now reference the correct file locations.

1. Open the iTunes Library XML with a Text Editor with a Find/Replace function.
Note: Vista users can find the Library XML at C:/Users/Username/Music/iTunes
Tip: Do not try to do this with Dreamweaver if your Library XML is greater than 10MB.
2. Perform a Find/Replace using the following inputs:
Find: Path from Step 1 of Moving Your Files
Replace: Path from Step 2 of Moving Your Files
3. Confirm your results, and then save and close the Library XML.

Delete the iTunes Music Database

Hacking the iTunes Library isn't enough to fool iTunes. Like the Library XML, the Music Database also holds the file locations of all of the media stored within the program. And it's smart enough to wipe out the Library XML hack if iTunes is opened before completing this step.

Ensure you have backed up the iTunes Music Database (iTunes Library.itl) and delete the file.
Note: Vista users can find the Music Database at C:/Users/Username/Music/iTunes
Back in iTunes

Once the fix is in place you can now open iTunes again. You will notice that all of your playlists, music and other items have vanished. In order to recover them all (with the exception of the Smart Playlists mentioned in the About the Workaround section above) we'll need to import the hacked Library XML file back into iTunes.

1. Open iTunes and press CtrlShiftO or go to File > Import…
2. Navigate to and Open your modified Library XML (as pictured below).
3. iTunes will then begin importing the contents of the XML file (as pictured below).
Note: This process may take a while, depending on the size if your library.

Wrapping Up

Once the import process is complete iTunes will look almost exactly the way you left it, with the exception that some playlists have been duplicated and the number of songs may be a hair off. To fix this problem delete any duplicate playlists in the "Library" panel in iTunes. You can now test out the changes by selecting an item moved earlier and testing it out. All that's left from there is to let iTunes perform any automated analysis it needs to do and rock on.

  Other OS  
  • Chris CA Level 9 Level 9
    Why not;
    1 - Menu Advanced - Consolidate library.
    2 - Quit iTunes.
    3 - Move the iTunes folder where you want.
    4 - Start iTunes holding the Shift key.
    5 - Select Choose existing libry.
    6 - Select the iTunes library file in the folder you just moved.

    Eveything is retained, playlists are not duplicated and the number of songs is the same.
  • Holy Smokes Level 1 Level 1
    Thanks for your input, Chris. I would recommend your methods, which consolidate all music into the iTunes directory, to someone who:

    (1) Would prefer to keep all their music in a central location;
    (2) Has enough disk space on the partition where the iTunes folder is moved; and
    (3) Is not wholly concerned with keeping existing file system structures organized and intact--for the purposes of other applications.

    My post opens in an attempt at limiting the target audience to "[any] iTunes 7.x user who [manage] their own music library outside of the 'iTunes Music' folder". But I'm sure others will find your process useful (and much easier). Thanks again!
  • datimezz Level 1 Level 1
    Holy Smokes:

    I appreciate your detailed workaround post. My question is this: I use iTunes to keep everything organized (though I'm well aware of the shortcomings...) and can use the simple solution that Chris from CA posted, but I don't have room to consolidate everything. My read on consolidating is that you copy from wherever you have your music located (and right now my music is outside of the MyMusic/iTunes folder, as that backs up to my work server) and so you have to have enough room for all of your music to be copied (and then you delete it from its prior location). That's how Apple describes it in, e.g., http://docs.info.apple.com/article.html?artnum=301748. I ain't go that kind of room. Is there any way to make the move to a completely different PC by following the simple option? From the posting I just linked it sounds like you MUST consolidate whether you use you iPod to move things or use an external drive.

    Of course, I can use your workaround, but I thought I'd ask first. Many thanks.

      Windows XP Pro   iPod Video 60gb
  • Chris CA Level 9 Level 9
    Open iTunes prefs -> Advanced and set the iTunes library to where you want it (the external drive)..
    Then consolidate.
    Everything in the library will get copied to the new location instead of the internal drive.