How To: Clear Dead Tracks from Your iTunes Library on Windows Using Only Notepad

Clear Dead Tracks from Your iTunes Library on Windows Using Only Notepad

If you've ever mistakenly moved your music files around without relinking them in iTunes, you might now be noticing that you have a long list of tracks asking you to relink them.

You could go through them one by one, redirect them to the new file location, then delete any copies. Or you could try to track them all down and delete the old references. But come on, who wants to spend that much time when you can clean up your library using this clever method using only Notepad on your Windows computer.

Step 1: Open Up Notepad

We're going to be making a run at this problem using a script, so open up Notepad. Don't worry, the code's already written for you, you just need to copy and paste it.

Step 2: Copy This Code Snippet

Copy the code over at GitHub, which looks like this:

Step 3: Save It

Save it as something descriptive, such as "RemoveDeadTracks.js". Make sure to save it with the .js file extension, as this will tell your OS that it's a JavaScript file!

Step 4: Run It

Now simply run the file by double-clicking on it. In a few minutes, it should open a dialogue box telling you how many tracks it deleted. Feel free to keep this code handy for whenever you need to clean up your iTunes library!


If it isn't working, make sure your computer didn't save the file as "RemoveDeadTracks.js.txt" by default. Make sure that the actual file extension is .js.

Now this is how you do it on a Windows computer, but does anyone know of a way to do this on a Mac?

Just updated your iPhone? You'll find new features for Podcasts, News, Books, and TV, as well as important security improvements and fresh wallpapers. Find out what's new and changed on your iPhone with the iOS 17.5 update.


what a beautiful little script .... absolutely awesome !!

I can't get this to work: This windows script host error pops up. It say Line 2, Char: 1, Syntax Error, 800A03EA Microsoft JScript compilation error.

Anyone had the same problem? Or know how to solve it?


Sweet!! that was very useful!!! thanks a lot!! :)

Wow, I had no idea javascript was so damn powerful.

Thank you!!
This worked.. Finally found a solution to the 1700 dead tracks.

Share Your Thoughts

  • Hot
  • Latest