How can I de-dupe my entire music library while preserving iTunes data?
February 13, 2009 4:49 PM   Subscribe

How can I de-dupe my entire music library while preserving iTunes data?

Don't ask me how, but I've recently discovered my entire iTunes libary exists in duplicate. Now, normally this wouldn't be a huge problem, just ditch the duplicate files and re-import. However, my music files are structured as such:

Music -> [Artist] -> [Album 1] [Album 2] -> [Track 1] [Track 2] etc.

Each track is buried within each album file which is buried in each artist file.

Bonus: The files which are currently "the good files" (those which iTunes is pointed towards) are those which were more recently duplicated. In other words, each .mp3 files ends with a (1) at the end of the file name. Being the crazy compulsive person that I am, this seriously bothers me.

Is there any way to run a script on the music folder that will trash any file that ends in 1? I really don't want to have to go through these by hand as there are 244 artist folders and 490 album folders.

Double bonus: I know I'll have to re-import, but I'd like to keep the track ratings (I use a bolean system, they are either 5 star or no star) and the play counts, as I have smart play lists based on this. I've already exported my iTunes library file, but am not sure that is enough to keep anything besides my playlists.

Please help!
posted by DrDreidel to Computers & Internet (12 answers total) 9 users marked this as a favorite
You should be able to do this with Dupin with the right filtering. It should be by date since the "1" set should be added later.
posted by immlass at 5:13 PM on February 13, 2009

Response by poster: I think I need to further clarify. I have no dupes in my iTunes, but rather in the folders that contain my music files. It looks to me that Dupin only scans your iTunes library so it isn't catching the file dupes, unless I misunderstood the program.
posted by DrDreidel at 5:20 PM on February 13, 2009

Best answer: So, you've got a good (non-dupe) list in iTunes, but the music folder itself has duplicate files?

Change the location of your iTunes music folder (in iTunes prefs), then Consolidate Library. This will copy new versions of everything in the iTunes list to the new folder. Then you can trash the entire old folder, and put the new folder back in its place, re-changing the iTunes music folder location in prefs again.

Doug's Applescripts for iTunes will have lots of great scripts to chew off the trailing "[1]". The simplest is "Remove N Characters From Front/Back".
posted by Aquaman at 5:37 PM on February 13, 2009 [1 favorite]

This won't mess up any of your playlists, ratings, etc. at all, BTW.
posted by Aquaman at 5:38 PM on February 13, 2009

OK, I was unclear on the problem; sorry about that. Aquaman's solution should work for the problem you've got.
posted by immlass at 5:47 PM on February 13, 2009

1. Search for mp3 in Spotlight
2. Select "Show all"
3. Sort by date
4. The messed up files will be the most recent ones presumably
5. Select them and delete
6. Repeat with m4a and other formats
posted by swift at 5:54 PM on February 13, 2009

Or, if the duplication didn't happen all at once, do this:

1. Search for "1.mp3" in Spotlight
2. Select "Show all"
3. Go the Music section and delete the bad files
posted by swift at 5:58 PM on February 13, 2009

4. Repeat with other formats...
posted by swift at 5:59 PM on February 13, 2009

and of course use [1].mp3 or (1).mp3 instead if appropriate. That's all.
posted by swift at 6:01 PM on February 13, 2009

in the Terminal:

find ~/Music -name '*.mp3.1' -print0 | xargs -0 rm

posted by nicwolff at 6:19 PM on February 13, 2009

...assuming you mean the whole file name ends with ".1". If not, put whatever all the bad file's names end with in the quotes.
posted by nicwolff at 6:21 PM on February 13, 2009

I happened to see this piece of software the other day, but I have not tried it myself. Perhaps it can take some of your pain away.

posted by silsurf at 9:36 AM on February 17, 2009

« Older Donations and Dragons   |   Help me decorate my dining room Newer »
This thread is closed to new comments.