Back when I first imported the majority of my iTunes library I had the copy files to iTunes Media folder when adding to library option checked, so basically my whole music library was duplicated on disk which means there's about 17 GB of wasted space.

I want to get rid of the duplicated data in the iTunes Media folder, however, there are some issues associated with this that I don't know how to overcome.

If I just delete the duplicates from the iTunes Media Folder, when I try to play those songs in iTunes it will say file is missing, do you wish to locate it?, and with around 2.7k duplicates this is not an option.

So, the next common sense thing to do would be to delete all the duplicates from the iTunes Media folder, delete my whole library from iTunes, move the left over files from iTunes Media folder to my original music folder and then just re-add all the files from the original music folder. However, then I lose all my rating and play count data.

So, whats a way I can delete the duplicates from my iTunes Media Folder while keeping my rating/play count info for each song intact? Note that I already have the means of physically deleting/recognising duplicates.


So it looks like the song metadata information is stored in ~/Music/iTunes/iTunes Music Library.xml. This includes a location key/value pair which could be modified to change the physical location of a song.

I am using this tool to find and report duplicates, http://code.google.com/p/liten/ . It reports them in a csv file, so I'm guessing I could create a program that parses the csv file and then makes the changes in the iTunes Music Library.xml file accordingly.

Any suggestions for what language I should use for this or if such a program exists already? Any algorithm tips? For example, should I parse the whole csv file first, which will require keeping all the filenames in memory, and then modify the xml file in one hit, or should I go back and forth?


iTues Folder Watch will what you want. I don't think the free version does, but a license is only EUR 7.50. In addition to scanning folders and adding files it finds, it can also identify entries in iTunes whose files are missing and remove them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.