iTunes Tricks

Deleting Duplicate Songs in iTunes (sorry, only on a Mac)

Maybe you've had the same experience as me. You sit down one day with your brand new computer, all excited to load your unnecessarily large music collection on to it: a music collection that's been on multiple computers in multiple versions of iTunes. Somehow, each time you copied it to a new device, it mysteriously grew by a few GB. When you take a closer look, you realize that hundreds of tracks were duplicated somewhere along the way.

"Easy enough", you say! You click on "View->Display Duplicate Items" and get ready to drag all those pesky duplicate tracks to the trash. But then you realize there's a problem...

iTunes does not display true duplicates! It only displays tracks that have the same artist and song, which, in my opinion, is nonsense. For a lot of my favorite songs, I have four or five favorite live performances that I like to listen to. And I certainly don't consider them to be "duplicate items". Also, some classical albums call an entire symphony by one track name even though they're different movements of the same work.

But then you do some more searching and find that you can hold down [Option] and click on "View->Display Exact Duplicate Items" to get all of the exact duplicates. Great! But if you have a thousand exact duplicates, that means you'll have to click 1000 separate times to delete all of them (maybe you can figure out some clever way to sort them so that it's easier, but I couldn't).

Well, there is an easy way to get this done. It involves downloading a very small, 5kB script, and following the six steps below. Be careful to backup your library and examine things closely before you do the final delete.

Step 1: Download AppleScript to Copy True Duplicates to Another Playlist

You can get the file CopyDoublesToNewPlaylist.scpt here. When you download it, make sure you keep the extension as .scpt (the extension for the native AppleScript files).

Double Click the file. You should see something like this:

Step 2: Make a Playlist for Potential Duplicates

Create a playlist called "PotentialDuplicates", or whatever else you want to call it. You will have the option to enter whatever name you want when you run the script (the program is made this way so you can use whatever playlist you want when you remove duplicates).

Step 3: Make a Playlist for the Real Duplicates

You will need a playlist to move all of the true duplicates to. Create a new playlist and call it "RealDuplicates". Do not use a different name or you will get an error later on.

Step 4: Display The Potential Duplicates and Copy them to the Potential Duplicate Playlist

a) Go to your full music library and use the iTunes feature "View->Display Duplicate Items" to display all of the files that iTunes thinks are duplicates.

b) Copy all of these files to the playlist you created in Step 2. You can see in my case below that iTunes found some real duplicates and some that are actually entirely different works.

Step 5: Run the CopyDoublesToNewPlaylist.scpt Script

Click the "Play" button in the CopyDoublesToNewPlaylist.scpt window. You will be asked for the name of the playlist you want to copy the real duplicates from. Enter "PotentialDuplicates", or whatever you called your playlist in Step 2. Click "Ok".

Step 6: Delete all the Real Duplicates from the RealDuplicates playlist

a) Select the "RealDuplicates" playlist. You will see that all of the true duplicates have been copied to this playlist!

Note: It takes some time, so you can actually watch the playlist as they accumulate. Make sure you wait until the script is done running.

b) Highlight all of the tracks in the playlist by either clicking [Command][A] or using the mouse and the shift key together. Then press [Option][Delete] to delete the files. You will be prompted two times. Once on whether you want to remove those files from the playlist, and again on whether you want to keep the files or move them to the trash. Since they are really true duplicates, you can just move them to the trash. You're done!