2

3 answers and unfortunately no solution yet.

The Problem

I've got way more than 1000 duplicated items in my iTunes Library pointing to a non-existant place (the "where" under "get info" window), along with other duplicated items and other MIAs (Missing In Action).

Is there any simple way to just delete all of them and only them? From the library, of course.

By that I mean some MIAs are pointing to /Volumes while some are pointing to .../music/Music/... or just .../music/.... I want to delete all pointing to /Volumes as to later I'll recover the rest. Check the image below.

Some Background

I tried searching for a specific key word on the path and creating smart play list, but with no result.

Being able to just sort all library by path would be a perfect solution! I believe old iTunes could do that. PowerTunes can do it (sort by path) but I can't do anything with its list. I would also welcome any program able to handle this, then import and properly export back the iTunes library.

PowerTunes showing Path Column and duplicated items

Since this seems to just not be clear enough...

AppleScript doesn't work

That's because AppleScript just can't gather the missing info anywhere in iTunes Library. Maybe we could use AppleScript by opening the XML file, but that's a whole nother issue.

Here's a quote from my conversation with Doug the man himself Adams last december:

I don't think you do understand. There is no way to get the path to the file of a dead track because iTunes has "forgotten" it. That is, by definition, what a dead track is.

Doug

On Dec 21, 2010, at 7:08 AM, Caue Rego wrote:

yes I understand that and have seem the script. but I'm not looking for the file. just the old broken path reference to it.

Sent from my iPhone

On 21/12/2010, at 10:00, Doug Adams wrote:

You cannot locate missing files of dead tracks because, by definition, a dead track is one that doesn't have any file information. If you look at "Super Remove Dead Tracks", you will notice it looks for tracks that have "missing value" for the location property.

9
  • So Doug says the same thing I did in a comment to Brandon's answer ;)
    – Daniel Beck
    Jan 12, 2011 at 14:04
  • @Daniel yes. He could barely understand my question because it just sounded too absurd to his subconscience, I think.
    – cregox
    Jan 12, 2011 at 14:16
  • @Daniel btw... how you noticed my edit so quickly?
    – cregox
    Jan 12, 2011 at 14:31
  • Editing questions and answers moves the topic to the top of the front page.
    – Daniel Beck
    Jan 12, 2011 at 14:32
  • 1
    A bit of both. Click me!
    – Daniel Beck
    Jan 12, 2011 at 18:00

5 Answers 5

6

I would recommend trying out Doug's Applescripts:

http://dougscripts.com/itunes/


There are many free Applescripts that are more tailor-made for a specific issue rather than a one-size-fits all solution such as FixTunes or PowerTunes. I have used the Super Remove Dead Tracks v2 before and it worked well.


There are also scripts for:

  • Removing duplicates (Search for Super Remove Duplicates)
  • Playing a random song from a random playlist, and other things iTunes should do
  • Better mass tag editing
  • Script to send contents of clipboard to iTunes as current song's lyrics (WAY cool): *
  • And also "ScriptPal", a floating palette plugin that allows you to manage and run scripts much more easily than before.

Oh yea, all of these are also free and adjustable yourself (just learn AppleScript, it's THAT easy lol) unlike a paid program which can't be adjusted.

9
  • Edited your post to link to the dead tracks script. The last paragraph didn't make sense in the context of this topic and after my edit, so I removed it. Hope I didn't make a mistake with that.
    – Daniel Beck
    Dec 20, 2010 at 9:57
  • Yes, got all Doug's scripts and few more. Thanks for pointing them, they are great! Just not for this task. Maybe I should learn how to script myself.
    – cregox
    Dec 20, 2010 at 12:41
  • Would any of you, Brandon or @Daniel, happen to know applescript enough to tell me how I can retrieve that location info? I do know it's surely stored somewhere as I mentioned on the question but using file track's location brings only missing value.
    – cregox
    Dec 20, 2010 at 18:41
  • @Cawas I can only guess (and reproduce the issue) that it's missing value because the path does not exist, and the type is alias, which probably requires a path to exist. Even converting to POSIX path does not work.
    – Daniel Beck
    Dec 20, 2010 at 18:51
  • 1
    To people who are voting this answer up, you really should pay more attention and read before voting. Or at least do what I do and keep on the "dynamic reading" but also voting the other answers up as to not give weight for just 1 uncertainty. :D
    – cregox
    Dec 21, 2010 at 15:18
1

Did the non-existant path exist at one time? That can help you figure out why this happened. What I would do in that case is move the iTunes Library heirarchy you do have back to that location and work from there. If you don't have one or it just doesn't exist, here's a pretty foolproof method of doing what you want, though it's not all that pretty:

Go to File->Library->Organize Library... and consolidate your library. Delete/Archive your existing Library data file (the stuff in ~/Music/iTunes/ that sits next to the iTunes Music folder) or generate a new library for iTunes by launching it while holding Option.

Drop the iTunes Music folder mentioned above onto the now blank iTunes app. It'll import only the songs you actually have data for.

Edit:

Okay, you asked for it :-)
Hack the iTunes Music Library.xml file. I'm not going to test this myself, but you should be able to be successful.

  1. Make lots of backups and quit iTunes.
  2. Get a good plaintext editor and use it to edit ~/Music/iTunes/iTunes Music Library.xml
  3. Use some sneaky find/replace/RegEx and delete every <key><dict> pair that contains the nonexistant path in the Location key string.
  4. I read somewhere that the iTunes Library file is reconstructed from iTunes Music Library.xml if it's found to be corrupt. If the changes you made to the XML haven't taken effect by now, you may need to delete ~/Music/iTunes/iTunes Library, or just open it up in the text editor and mess with it a little. Might take some experimenting, but report back when you find out what works!
4
  • Yes, the path exists and it's actually an external HD that I use for backup. I tried consolidating / "reorganizing", but didn't work. Everything else you suggested seem to potentially delete all my iTunes metadata, specially the ranks. I really wish to avoid doing that. Any more ideas? :P
    – cregox
    Dec 20, 2010 at 4:10
  • about your edit, I'll try that as plan B. thanks. :)
    – cregox
    Dec 20, 2010 at 5:33
  • I actually tried using plan B, but it ain't that simple. I'd need a RegEx to copy every <key><dict> into some field iTunes could sort. But all regular fields already have data! Plus, such RegEx is non trivial.
    – cregox
    Jan 9, 2011 at 2:37
  • Just as a reference, here's more on plan B: xml.com/pub/a/2004/11/03/itunes.html
    – cregox
    Jan 14, 2011 at 10:47
1

Use PowerTunes to fix your library.

alt text

6
  • sounds amazing! trying it out right now...
    – cregox
    Dec 20, 2010 at 5:33
  • @Cawas Did it work? I don't understand the edit to your question.
    – Daniel Beck
    Dec 20, 2010 at 6:54
  • Sorry for not giving you a notification, Daniel. Didn't want to bloat every answer with my un-ending comments, but I guess it's too late now anyway. I'm still trying to make it work, but so far it didn't. I could find a column "path" I could add to the main window, and order by it - it is all I needed (and I'm pretty sure iTunes previous than 10 had this)... But then I can't use that to delete them!
    – cregox
    Dec 20, 2010 at 12:43
  • @Cawas So you really need the path? I tried it a few weeks myself on a relative's machine and there is just no way to access the path in iTunes itself AFAIK. This answer is more about how you can fix/remove the tracks -- I guess I didn't understand your question then (perhaps you can edit to clarify?). And don't mind the comment thread -- I seem to provoke them ;-)
    – Daniel Beck
    Dec 20, 2010 at 12:53
  • Well, I actually do appreciate every other answer here, because this is [not the only thing I need to organize in my itunes][superuser.com/questions/224040/… (how you do links in comments?). But, yeah, for this question the path is all i need and PowerTunes made me realize / remember of that discontinued option. Btw - 26 comments! Well, you did get Arjan there with you, which explains a lot. ;P
    – cregox
    Dec 20, 2010 at 13:10
1

Some misconceptions:

The XML file is not used by iTunes at all. It is created for the benefit of third-parties.

You cannot locate the file path of a dead track because it is no longer in the iTunes database, which means it will not be in the XML either.

There is no extant file path of a dead track anywhere. You might be able to use the Artist and Album name of a track to search the iTunes Media folder for it. For example, the file for the track "In the AIr Tonight" on the Phil Collins' album Face Value might be located at iTunes Media/Music/Phil Collins/Face Value/In the Air Tonight.ext, but there is no absolute certainty that it is.

1
  • Sup crazy Doug?! So, what you're saying here is that there is just no way? :-o
    – cregox
    Apr 10, 2012 at 10:51
0

Perhaps I don't understand the full scope of the question.... And I'm a Windows user.

Inside of iTunes: Select all the files, Get info on the lot of them.
Every file that can't be found will have an exclamation mark in the leftmost column (grey circle, white mark)

See if these lost files have any common searchable denominator - for me it usually is a date (added, modified), or Artist. Then search and destroy on that. Yes this could involve a lot of selecting of individual files but you could be listening to music at the same time.

Before you delete any files though, you should be sure that the MIAs weren't on an external or old drive. Try to connect to any network, external etc. storage. Did your roommate stop sharing a folder?

For duplicates - I haven't found a fail safe way of selecting the "right" files to delete. iTunes doesn't do a good job of pairing files (duplicates). I'd be pleased to hear of a good way to attack this problem

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .