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:

Delete the aliases from the finder

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 ?

2 Answers
2

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.

I'm in the middle of this painful task myself. If you have a Windows OS, you may find the following tools in Command Prompt useful after you open command prompt and change directories to your music directory:

dir /s /b "* 1.mp3" > found.txt

which searches all subdirectories (/s) and in a very basic format (/b) lists every single file that ends with " 1.mp3" and exports it (>) to a new text file called found.txt. It's very important that before you delete anything vital that you comb through this list to temporarily transport false positives such as "02 My favorite long chapter - part 1.mp3" to a separate directory BEFORE you start attacking every file that ends with " 1.mp3".

erase /s "* 1.mp3"

after completing the previous step, cross your fingers and hope that you have safely transported all false positives to a safe directory, then press enter and watch the command prompt permanently delete every offending file.