iTunes Library problem - how to search and delete for similar filenames with different extensions? 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.

example
Music Directory:


Directory1:

file1.mp3
file1.m4a




Directory2:

Subdirectory1:

file2.mp3
file2.m4a
file3.mp3
file3.m4a
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.