An iTunes error (documented in this AskDifferent thread) has left my library folders full of duplicate files, but with different extensions. Over time, when I have found an album that iTunes can't find I have deleted the local files and downloaded from iCloud. This has left me with the downloaded m4a files but also the original 'lost' mp3's - the files were never actually missing, but the links in the iTunes database were corrupted somehow.

I could delete the entire local library and then download from iTunes Match/iCloud but it's a very large library and this could take many days on my internet connection.

Trying to convert the 'known' mp3's to m4a's and deleting any left over 'lost' mp3's would take far too long.

Could a terminal command or applescript search within a folder and match identical base file names but different mp3 and m4a extensions and then delete the corresponding mp3 file when found? It would need to do this recursively down into each folder and sub-folder within the music folder.

Music Directory:

  • Directory1:
    1. file1.mp3
    2. file1.m4a
  • Directory2:
    • Subdirectory1:
      1. file2.mp3
      2. file2.m4a
      3. file3.mp3
      4. file3.m4a

1 Answer 1


Ok - this was much easier than I expected. Work around that I used was to select a new location for library in iTunes and then Library > Organise Library.

This moved all the 'known' files and left all the old mp3's. I deleted the contents of the old iTunes library and then moved it back.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .