How To Delete All Songs In Itunes Library At Once

0 views
Skip to first unread message

Edco Haglund

unread,
Aug 4, 2024, 6:38:28 PM8/4/24
to bersgranpurcu
Thisarticle was co-authored by wikiHow Staff. Our trained team of editors and researchers validate articles for accuracy and comprehensiveness. wikiHow's Content Management Team carefully monitors the work from our editorial staff to ensure that each article is backed by trusted research and meets our high quality standards.

This article has been viewed 431,943 times.



Learn more...


If your iTunes library is getting a bit out of control, you can clean things up by deleting music you no longer listen to. When you remove songs from your iTunes library, they'll be removed from any devices they're synced to next time you sync. When you delete songs directly on your iOS device, they are completely removed. Songs that you've purchased may be hidden when you delete them, and can be unhidden with iTunes.


Some how I got duplicates of my library on iTunes and to get rid of all the new duplicates I went to the library I looked for the date the new duplicate songs were added to the library then I went to columns and where you see Artist, song,


bit rate, time, etc and added 'date added' once that's done click on the box enclosing 'date added' and you will see all songs added by date. Proceed to the last one of the songs with that date press command to highlight it then scroll all the way to the first song and press 'shift' to highlight all of the songs added on that date then simply press delete.


iTunes has two modes for displaying duplicates. The first is accessed via File > Display Duplicates and lists all tracks in the current playlist where the same track title occurs more than once. This is, more often than not, a rather loose definition of the term and can bring back obviously different songs, e.g. studio and live versions of the same song, the same song recorded by different artists, or by the same artist but on different albums, or completely different songs that have nothing in common but their title.


A more useful feature can be found if you hold down the SHIFT key and then select File > Display Exact Duplicates. This gives a list of all tracks where more than one track has essentially the same metadata, name, track no., artist, album, etc. (I'm not sure what the exact criteria are for an exact duplicate as far as iTunes is concerned, but it's good enough for most needs).


Note you could also have files which have the same audio data but different metadata, e.g. the same album ripped twice but with a slightly altered album title, however there isn't an obvious way to highlight these within iTunes.


Once you have used the Show Exact Duplicates feature you can set about deleting all but one copy of each duplicate file. If all the duplicates have recently been added into your library then you could sort the list on the date added column, select a range of tracks with SHIFT-click and delete all the recent entries. If the duplicates have been added into the library at various times then sort the list by album or track name, select all but one of each group of matching tracks with CTRL-click and delete the selection. Probably best to work one screenful at a time.


Of course the issue isn't quite as simple as it seems. If the duplicates are of type 1 then you want to delete the tracks from the library, but not delete or send the underlying files to the recycle bin as there is only one copy of each file referenced by the duplicate entries. For tracks of type 2 you do want to delete the duplicate physical copies leaving one remaining version. For files of type 3 you probably want to decide which of the two or more copies you want to keep, the smallest to take up less room, the largest because it is the best quality, the MP3 version because it is the most portable or more than one because each has their uses for you.


By now you should have some idea of why deduping is not a trivial issue. Of the three types I have described it turns out that cleaning up type 1 duplicates is quite easy to automate. I've written a script called DeDuper which can go through a selection of tracks, spot those with the same path and remove the redundant entries. As a bonus it retains the entry with the earliest date added value, adds in the play & skip counts from the deleted entries and sets the last played/skipped dates to their most recent values. Although the script would work on the whole library it will be much more efficient to use the iTunes Show Exact Duplicates tool before running the script. You should also backup your library or, at the very least, the iTunes database iTunes Library.itl before running the script. Chances are you have type 2 duplicates and the script is of no use to you in its present form...


I hope to extend the script over the next few days to cope with type 2 and type 3 duplicates, ideally making the distinction between the two types, handling type 2 automatically (hopefully moving the removed files to somewhere they could still be restored from if required) and prompting for the user to choose which file to keep in the case of type 3. Again metadata would be merged. Hmm, just realized I need to do something about rating too.


Yes, I believe that's the problem. You are probably right, it could happen getting playlists from Macs, too. I made a quick hack and it fixed my problem, but I don't know anything about VB, and I'm sure my hack isn't complete.


Thank you for the incredible amount of work you have put making iTunes palatable for the rest of us. My iTunes library is on my home NAS. I read through most of this thread and then downloaded DeDuper today from your website on a test of 25 duplicates:


I just used the DeDup script on nearly 6000 duplicate files. It worked like a charm. And I don't know a thing about "scripts." I just followed the directions and let the DeDup script do it's thing. It saved me hours, or days, trying to manually delete all those duplicates. I highly recommend the DeDuper.vbs script! THANK YOU!


I've completed a new version of the DeDuper script that can now automatically delete redundant copies of both type 1 and type 2 duplicates where type 1 are identified by having the same file path, and type 2 by having the same artist, album, disc no., track no., track name and file size. As before the earliest imported copy of each file is preserved, play & skip counts are combined, the latest played or skipped dates are set and, in addition, the highest track rating is preserved. Type 2 duplicates which are deleted are sent to the recycle bin, but given the tests of both metadata and file size it is extremely unlikely for these files not to pure byte by byte duplicates that we are happy to delete. I'll leave type 3 for cleaning up by hand.


The script isn't very fast, at least not for me, but that is probably down to old hardware and a largish library. iTunes rewrites the entire database after every minor change so the larger the library, the slower a script will run. Test it on a few hundred tracks and, if you are happy it performs as described, leave it to run while you do something else. The program runs in two separate stages and after each you can decide whether or not to proceed with the removal of redundant copies.


I went ahead and debugged the problem. It turns out there were '/' characters in some of the names pulled from playlists, because they were done on a Linux system. That's what was confusing things. I'd suggest a global replace of '/' with '\' before


does it? I guess this could potenentially happen with libraries/playlists migrated from Macs too. I should probably correct for that error earlier in the processing as it might be missing some logical dupes (two entires to same file) with the current code.


A second attempt to add the same file will normally be ignored. However if an existing file isn't where it is supposed to be (e.g. external drive offline), and iTunes gives it the exclamation mark, then you can restore the file (e.g. connect the drive) and add it without iTunes detecting that the file is already in the library. Next time you attempt to access the "missing" file, iTunes will find it again, but now you have two files with the same file path aka "logical dupes" or "type 1" as I called them earlier.


I've posted an updated version of the script which will replace "\" for "/" in the paths for the logical dupe detection cycle and when attempting to send a file to the recycle bin so that should cover that issue.


About a year ago I switched over from using iTunes to Rdio. It's been fantastic. Since everything is in the cloud, I can simply "add" albums to my collection rather than having to go through the painful process of downloading and syncing.


The only thing stopping me from using Rdio exclusively is the fact that they still don't have the rights to stream music from bands like Led Zeppelin, Metallica, and Tool (bands that no human being should have to live without). So I've still kept a huge mp3 collection on my local hard drive. I'd love to be able to just delete all those files if I can find an easy way to stream them online.


Is there a way that I can sync my local collection to the cloud using iTunes Match and then just delete all the local mp3 files? I've read countless articles about iTunes Match but it does tend to get a bit confusing, especially for someone like me who ideally just wants 0 bytes of music data stored locally.

3a8082e126
Reply all
Reply to author
Forward
0 new messages