iTunes Fix for Manually Moving Music and other Media
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 Ctrl ShiftO 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