Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Remove duplicate iTunes songs manually Apps
I realize that there are a bunch of nifty automatic techniques for cleaning up your iTunes library and removing duplicate songs, but sometimes I feel like I want to do something manually (I have had some batch mishaps in my past).

Anyway, this just occurred to me as I was cleaning up my music library. If you arrange the iTunes library by song length, you can quickly scan for matching song lengths and then look for matching artists (because sometimes the title doesn't match, and hence batch processing or applescripts don't always yield proper results).

From there you just simply hit the delete key and remove the duplicate, a very simple yet effective way to clean up your library.
    •    
  • Currently 3.00 / 5
  You rated: 3 / 5 (4 votes cast)
 
[18,878 views]  

Remove duplicate iTunes songs manually | 7 comments | Create New Account
Click here to return to the 'Remove duplicate iTunes songs manually' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Staying Organized
Authored by: beedee on Feb 11, '03 11:15:39AM

I have a good method for keeping my iTunes Library organized when adding new stuff.

First off, I have the "Keep iTunes Music Folder organized" and "Copy files to iTunes Music folder" options enabled. I often download music from various places (emusic subscription, epitonic.com, limewire, etc.). Many times I am downloading new artists/albums that I want to check out, and many times I don't really like everything I've downloaded.

So I always drag my new music into a playlist named "_New". Once I have listened to everything and decided what stays and goes, I delete all the tracks from the playlist that I like (they're still in my iTunes Library), select all the remaining tracks in the playlist, hit Cmd+I, and add the comment "Delete Me", then I go into my main library, type "Delete me" into the search box, and finally I select all the tracks and hit Cmd+delete.

A quicker method (but only usefull if you use it right away), is to just right click on the column titles in the main library window and turn on the "Date Added" column. Then you can sort your library by the day that songs were added to your library and delete what you wish.



[ Reply to This | # ]
Staying Organized
Authored by: tortislc on Feb 11, '03 06:51:33PM

What other techniques are out there to remove duplicate songs automatically? Without manually going through your playlist?



[ Reply to This | # ]
Staying Organized
Authored by: DeltaTee on Feb 12, '03 11:00:10AM

There are many AppleScripts that help to remove duplicate items from the playlists.

If you have a problem with the same physical file being added to the library twice, I would suggest my Remove Duplicates (by Filename) script. (More information is available at http://applescript.plaidcow.net/)

If you find that iTunes "keep music organized" is a little too constraining, I have an Organize Files script that will organize your directory based on any ID3 tag information that you want to use. Rename Files will similarly allow you to rename files based on any ID tag information.

For deleting files from the hard drive (while removing them from the iTunes library) in one fell swoop (directly from iTunes) I have a Delete Files script.

All of these scripts have more information available on my website at http://applescript.plaidcow.net/

Let me know if they can be helpful to you.



[ Reply to This | # ]
Staying Organized
Authored by: hypert on Sep 15, '04 01:06:27AM

You don't need to select all the tracks you want to delete, add a comment, search for the comment in the library, and then press Cmd-Delete. Just select them in your playlist and press Cmd-Opt-Delete. This will remove them from your playlist AND from your Library!



[ Reply to This | # ]
Staying Organized
Authored by: hypert on Sep 15, '04 01:08:57AM
I just submitted this a little while ago as a new "hint", but now that I found this thread, I'll try to post it here. For some reason, I end up with a ton of "duplicate" tracks in my iTunes library and playlists. By this I mean that more than one track in iTunes maps to a single file on my hard drive. (I may get into this problem because I sync my files between my Mac and my PC, and an ID3 tag change made on my PC may cause iTunes on the Mac to think it's a whole new track when I re-drop the files back into iTunes.) Anyway, Doug Adams has some great Applescripts available to find and/or delete "dupes", but they don't always work for me. So, I wrote a Perl script to parse the "Song List" which can be exported from iTunes (in the File menu). There are 25 different "fields" associated with every track in the list, and the Perl script allows you to easily pick which fields you want (by editing the Perl script where documented). Here's the script:

#!/usr/bin/perl -w

use strict;
my $song;
my $lastSong = "";
my @songs;
my $DEBUG = 0;

if (scalar(@ARGV) == 0) {
    print "USAGE: $0 <filename>\n";
    print "The <filename> must be generated from iTunes' \"Export Song List\" function.\n";
    exit 1;
}

{
    # The exported file uses the Mac file delimeter.
    local $/ = "\r";
    my $file = shift;
    open(F, "$file") || die "Cannot open file '$file'.\n";
    @songs = <F>;
    close(F);
}

# Take off header row.
my $header = shift @songs;
if ($DEBUG) {
    # If you set $DEBUG, you'll see what each of the header fields are.
    # You can use this set which of the fields to use when determing dupes
    # (in the "map" statement a few lines down).
    my @header = split("\t", $header);
    for (my $i = 0; $i < $#header; $i++) {
	print "Field $i:\t$header[$i]\n";
    }
    print "\n";
}

# Consider four of the fields (Artist, Name, Album, Size) for the duplication calculation.
# If you set $DEBUG, some code above will print out what each of the header fields are,
# and then you can pick any fields to be included in there duplicate calculation here.
@songs = map { my @fields = split("\t"); "$fields[1]\t$fields[0]\t$fields[3]\t$fields[6]" } @songs;

@songs = sort(@songs);

foreach $song (@songs) {
    print "Looking at $song.\n" if ($DEBUG);
    if ($song eq $lastSong) {
	print "Duplicate: $song.\n";
    }
    else {
	$lastSong = $song;
    }
}


[ Reply to This | # ]
Submitted as an anonymous hint...
Authored by: robg on Jun 28, '04 09:15:34AM
But it really belongs with this thread, so here it is...
There are 2 easy ways to find duplicate tracks in your iTunes library. One, you can get a script from Doug's iTunes scripts at http://www.malcolmadams.com/itunes/index.php. There are some nice ones there, but they take a loooong time to run. After letting one go all night and still not be finished, I tried to come up with a better way.

I sort of did. When two tracks have the same filename and are part of the same artist/album, iTunes gives the second one a number; if you already have song.mp3 in an album directory, and another song.mp3 gets added, the second one will be renamed to song 1.mp3. So, if you want to quickly round up all of your possibly duplicate tracks, simply search in the finder for all instances of "1.mp3". Make sure that they're all real duplicates- stuff like part11.mp3 will come up, too.

Now, delete them. Start up iTunes. It probably won't know they're gone until it tries to do something with them. Try to sync up your iPod- this will make iTunes realize that the tracks are gone. (I had added a bunch of songs, many of them dupes, all in one day. So I made a playlist of all the songs added that day and then tried to sync that. That's how I was able to try to sync all of the dead songs even though my entire music library won't fit on one iPod.) Then, go to Doug's iTunes Applescripts and install and then run "Super Remove Dead Tracks". Viola.
-rob.

[ Reply to This | # ]
Quick'n'dirty shell command..
Authored by: HugoTheFrog on Jul 29, '04 09:21:04PM
Here's a quick command line to do what the above poster suggested..

find . -name '*\ 1.mp3' -print0 | xargs -0 rm
Run this from your ~/Music/iTunes/iTunes Music directory. NB: the escaped space ('\ ') will mean files like Chapter11.mp3 won't get deleted - but if you have 'Chapter 1.mp3' it will get deleted! User beware!

[ Reply to This | # ]