I’m a Windows guy, so some of your options will certainly differ if you’re one of those Apple types. Not that there’s anything wrong with that.
Remove Duplicates from iTunes – Before we start
We’ve talked about iTunes before. A lot! Relating to this particular subject, David Pierce explained how to use TidySongs to manage iTunes, and more broadly, Jackson produced a great eBook to help with all your iTunes needs.
How did this happen?
If only I knew. It’s a combination of recopying files to the machine after the rebuild, using the wonderful SharePod to rebuild the library, and some peculiar choices in the iTunes options.
Never mind. That’s ancient history, and there are many paths to this place. Doubtless, you took a different one.
Things to check
There are two things you want to make sure of before proceeding to remove duplicates from iTunes, and one general word of warning.
First, the warning. Please, please ensure you have backups in place in case any of this goes wrong. You are going to delete files, and you want to be sure you can get them back if nothing else.
If you are allowing iTunes to manage your files, you can just copy the entire iTunes folder (and all the subfolders) somewhere else. If you are managing the files yourself, take a look and be sure where you stand. Missing tracks is much worse than duplicate tracks.
There are two different ways that you can end up with duplicate tracks listed in iTunes. We ware here to remove actual duplicates. But first you need to check if you have duplicate items listed, but they are actually the same files. You can do this by sorting the tracks in name order (click on the Name column header), then right clicking one of the duplicates, and choosing Get Info.
Click on the Summary tab, and take a look at the file path after the Where: and then click on the Previous and Next buttons and compare the duplicates. Make sure the file names are at least a little bit different, or deleting one will delete both. In my case I have an Africa.mp3 and an Africa(1).mp3, for example.
The other thing to watch for is that the tracks are not near-duplicates. You know the stuff. You have the studio version, the live one, the unplugged one from the Nineties, the extended dance remix”¦ be sure you really want to get rid of those. Oh, lose the dance one. Go on.
Search and Eliminate
You probably already know you have some, and sorting your library by Title will certainly make it more apparent. If you have a small library, perhaps that’s all the help you need. It’s not going to work for me. I’ll still be working on it next year.
The first level of assistance is to ask iTunes to show you the duplicates. That’s easy. With your library still sorted by Title, click on File | Display Duplicates. This was when I started to get concerned. That’s a LOT of duplicate tracks.
If you want to reduce the work here a little, you can also ask iTunes to take a little more care with the selection. By default it’s only going to check the titles, but if you click on the Show All button to put things back to normal, and then go back through the process but this time hold the Shift key down while you click on File then you’ll get a Display Exact Duplicates option. For me, this made no difference at all but your mileage will vary depending on how you got the duplicates in the first place.
After that, the process consists of deleting the one (or more if necessary) duplicate files that you don’t want.
Getting help with the heavy lifting
I investigated making use of third-party products to take the back-breaking repetition out of the process.isn’t a free product, but the trial version will let you make use of the comprehensive duplicate selection criteria. Unfortunately, it won’t then remove all the duplicates automatically. I can understand that though, because why else would you purchase the full version? I moved on.
You Apple folk also have a whole stack of Apple Script options, but I can’t get near those.
My next option was a free piece of software called Duplicate Music File Finder. This one works outside iTunes, so there’s a need to clean up the resulting dead links afterwards. Hold your breath, start the app, point it at your music files, and let it check them out.
Just before we go further, a reminder. I’m trying to help, but the risk is yours. You need to have backed up all your music before you start.
Click the Check All button if you are happy that the duplicates have been selected, and then click on Delete Checked Files to actually remove them. Click Yes to confirm.
The application behaved for me exactly as expected, and all the duplicate files were moved to the Recycle Bin.
The last step in the process is to tell iTunes to take a look at itself, and remove any items in the library which no longer exist. Unfortunately there is no simple way in the iTunes interface to do this, so we need to cheat, just a little.
Apple has provided a script to do just this particular trick, and to make use of it you just need to do these things in order:
- Close iTunes if you have it open
- Go to the web page, right-click on it, and save the page as a file, making sure you change the extension to .js. So for instance, in Firefox, right-click on the page, choose Save page As”¦ and change the file name from RemoveDeadTracks.txt to RemoveDeadTracks.js.
- Open Windows Explorer and browse to the file you just saved
- Double-click on the file.
The script will open iTunes, and then start running through and removing dead links. In my case it took around ten minutes and correctly removed nearly two thousand links.
Give yourself a pat on the back.
I’d love to know how you go, whether you have found any more comprehensive tools, or if you can fathom how I got in this mess. In the comments, please.