Moving and Organizing iTunes Music Files

I’ve been looking for this solution for awhile but only just stumbled across it.  Over the years I’ve built up a sizeable collection of music from CDs, family members, friends, free downloads, iTunes purchases, Amazon purchases, etc.  Unfortunately, I never restricted myself to a consistent convention for storing and keeping track of these different files.

What I need is a way to pull all of the physical files into one place from which I can organize and run backups on those files.  Accompanying those files, however, is a wealth of meta-information in the form of ratings, playlists, play counts and album information that I don’t want to lose.

Solution: iTunes now includes a “Consolidate Music” option under the “Advanced” tab.  Running this process will copy every file listed in your Music library to the home location (this setting: Edit -> Preferences -> Advanced tab).  In my case, I ran this process once, moving everything to an external hard drive, deleted the original copies of the music, and then running it a second time to copy everything back to a single folder on the local drive.

Update:  “Copying music failed. The file name was invalid or too long.”

  • This is a result of filenames being too long, generally a result of artist and album information included directly within the file name.
  • To get around this problem, open up the file My Documents/My Music/iTunes/Itunes Music Library.xml and search for the location of the directory you’re moving things from.  The first instance of this directory will be that associated with the file iTunes had trouble with.  Navigate to this file and shorten its name to something more appropriate.  Next, find the song in iTunes, double-click on it, choose “yes” and find the newly renamed file.  You can now resume the consolidation process, repeating these steps whenever iTunes has problems.
  • The process may sound daunting but my collection includes ~6000 songs and encountered only 6 such errors.

12 thoughts on “Moving and Organizing iTunes Music Files

  1. Thank GOD someone out there had an answer for me. I’ve been trying to figure out the consolidation problem for hours, and this has finally fixed it. Thanks!

  2. hi, i don’t completely understand what to do here. Can someone please kindly explain it to me or give me a simpler solution please? I’m begging. Thank you

  3. Thanks for this tip. Since my music files were being consolidated from multiple different locations, I browsed through My Documents/My Music/iTunes/Itunes Music Library.xml until I saw a location that wasn’t the new location of my iTunes folder. The first file had a long title. As you suggested, I renamed the file on the old location. Then tried to play it in iTunes. It then asked if wanted to locate the file. I chose the shortened name and then went on to consolidate the library. This time it completed successfully.

  4. Awesome. This worked! I tried another script thats been floating around out there with no luck. This took a while, but it got the job done!

  5. Thank you very much. I was afraid that there was no solution, but yours worked perfectly. And for the record out of 3000 songs I only had to change 2. It was quite simple to find the filenames in the XML file; I used text editor to do a search for ‘Locationfile://localhost/X’ where X was the remote disk.

  6. Hi. thanks for your clarification on this issue.
    I need a little help however.
    I don’t understand the most crucial part.

    With wich program do I open the xml file and how do I find the first instance.

    quote:”open up the file My Documents/My Music/iTunes/Itunes Music Library.xml and search for the location of the directory you’re moving things from. The first instance of this directory will be that associated with the file iTunes had trouble with”

    I would be glad if someone could point that out to me.
    Thanks a lot.
    Marc

  7. WTF is wrong with Apple that they would just abort the whole program ??? They should at least let you skip that file or better yet, rename it and then continue. Jeez!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s