Skip

Song files in iTunes pointing to the wrong location.
July 19, 2007 7:29 AM   Subscribe

How can I fix 6.000 tracks in iTunes, which have a wrong file path, without losing play counts and ratings?

I just re-installed OSX on my Mac. After I did that some of the files on my external drive iTunes library are pointing to the wrong location.

Both the music files and the iTunes library are located on an external drive called "Musica". However, around half of the files seem to have the wrong path set in iTunes and therefore iTunes can't find them.

They are pointing at "Musica/FOLDER/Radiohead/OK Computer" - instead of the right one, which should be "Musica/Radiohead/OK Computer"

Now, this is easy to fix by just changing things around in the XML file. However, if I do that and re-import the XML, I will lose 4 years worth of play counts and ratings. And that's something I simply am not willing to do. The only one other way I know to do this is to point at each and every file and find the right location for each file. However, since I probably have more than 6.000 files pointing at the wrong location (I have around 8.000 pointing at the right one) that would take me days to complete.

So, are there any other ways to do this?
posted by einarorn to Computers & Internet (12 answers total) 4 users marked this as a favorite
 
Re-import what? Can you not just edit iTunes' XML (or whatever) in place? The worst thing I can think of is that it has some checksum that includes the file name.

Alternatively, from a terminal,
$ sudo ln -s Musica/FOLDER Musica (or the reverse)
posted by cmiller at 7:57 AM on July 19, 2007


you should be able to open the xml file in any text editor and find and replace the old text string with the new text. something like this:

find: "Musica/FOLDER/"
replace: "Musica/"

you'll need to really think about the strings before you start to make sure a global search and replace will work. if you've never done something like this before, i suggest making a copy of the original XML file before you start.

disclaimer: i've never done this on my mac, only on my old windows box.
posted by uaudio at 7:58 AM on July 19, 2007


just reread your post, its strange that you say "about half" have the wrong path. you may want to think about this when you enter your replacement terms, and how you confine the search.
posted by uaudio at 8:03 AM on July 19, 2007


Here's the suggestion that worked for me (and a caveat).
posted by Tuwa at 8:42 AM on July 19, 2007


Oops, I linked the wrong caveat. This is the one.
posted by Tuwa at 8:44 AM on July 19, 2007


Wow. Very easy, and no one's posted it yet?

Assuming I've understood your problem correctly, you go to Advanced, make sure the library location is set where you want it to, and then choose "Consolidate Library" off the menu. Bam.
posted by WCityMike at 8:44 AM on July 19, 2007


You might try this script. Start with just a few tracks to make sure it works, of course.
posted by aneel at 8:45 AM on July 19, 2007


"Consolidate library" will make a big mess of any mix CDs you have on mp3 and have dragged into the playlist from the hard drive rather than importing through iTunes (iTunes won't know that the tracks belong together and so will separate them into distinct folders by artist). Just a word of warning; it may or may not affect you, and it might not matter if you use iTunes to burn CDs rather than an external program.
posted by Tuwa at 8:56 AM on July 19, 2007


"Consolidate library" will make a big mess of any mix CDs you have on mp3 and have dragged into the playlist from the hard drive rather than importing through iTunes (iTunes won't know that the tracks belong together and so will separate them into distinct folders by artist).

Not if they have "Compilation: Yes" selected. (Select all tracks of mix CD, Get Info -- multiple-file ID3 editor pops up, set Compilation tag, etc.).
posted by WCityMike at 9:07 AM on July 19, 2007


Try moving the files to the folder that the XML files says that it should be in (so the file locations are correct) and then consolidating the library.
posted by charmston at 9:22 AM on July 19, 2007


The consolidate thing that CityMike suggests doesn't work. All the files are already in the root folder, it's just that iTunes thinks that some of them are in the Musica/Folder folder.

I think that Charmston's suggestion should probably work, but that will take a lot of work, since I have to locate which files iTunes doesn't find.

Aneel's script works, but that's also a lot of work, and the tracks lose their playlist places for some reason.

Cmiller, if I just do what you suggest, then iTunes will just look at the library and not the XML file. The only way to do this would be what I describe in the post (which is the same as Tuwa suggests), but that means that I lose play counts and ratings.
posted by einarorn at 11:44 AM on July 19, 2007


You may find this helpful.

Im planing on doing it next month.
posted by gergtreble at 1:11 PM on July 19, 2007


« Older So, the new boy's in a band! ...   |  Has anyone found a doorway gat... Newer »
This thread is closed to new comments.


Post