Delete duplicate aliases created by itunes when adding songs stored in the external hard drive

itunes

I have all my songs in my external hard drive, which is encoded in ntfs. When I add them to itunes, using File -> Add To Library ... it create an alias of each file in my /Users/<user_name>/Music/iTunes/iTunes Media/Music folder.

So far so good, but sometimes it gets confused and create 2 aliases for one same file (meaning the same file on my external drive). It also happens when I want to rescan a folder I have already added to iTunes, it will create a duplicate alias for all the files that were already there in iTunes.

So I end up with loads of duplicate aliases in my iTunes Music folder. It looks a bit like that:

<whatever the song name>.mp3
<whatever the song name> 1.mp3

So the second file is a duplicate. What I want to do is:

  1. Delete the aliases from the finder
  2. Delete the duplicates in itunes

As I have a lot of music, it would take a long time to delete everything manually. As I happen to be a software developer, I have written a script that deletes the duplicate alias files (in finder).

But then I end up with an iTunes library full of duplicates, that points to nothing since the alias as been deleted.

Is there a way to delete from the iTunes library all the files that can not be found ?

Best Answer

Try Dupin or Dupin Lite. Dupin is $15 from the developer's site, and Dupin Lite is $8 from the Mac App Store. I recently purchased the full version and used it to delete duplicates from a 57,000 song library. It did a very good job. It's filtering mechanism is highly customizable. It is not super fast, but it ran through my library in less than a day.

To specifically deal with your issue, you can set the rules to keep the file with the shorter filename. This will get rid of the commonly found "whatever the song name 1.mp3" file, while keeping the "whatever the song name.mp3" version.

Also, dougscripts.com should be your first stop for any iTunes maintenance scripts. I have found the following scripts especially useful in cleaning up large iTunes Libraries:
Artist - Name Corrector
Super Remove Dead Tracks
Search-Replace Tag Text v2.0
Track Parser
Remove n Characters From Front or Back