3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Delete those unwanted iTunes songs from your computer

Delete those unwanted iTunes songs from your computer
Hey there ladies and gentlemen, this is my first coding instructable, so please, when commenting, leave your guns at home (knives are acceptable, however).

With the advent of mp3 players, it has been made possible for people to carry unprecedented amounts of music around with them in their pockets. It is not uncommon to hear of people having collections of 5, 10, even 15 thousand songs (and some people, even more). Of the mp3 players, none is more popular than Apple's iPod and the software that runs it, iTunes.

With such large music libraries, however, it can become somewhat tedious to get rid of the songs that simply don't sound good or appealing to you anymore. It can take ages to go track by track through your music collection in iTunes and get rid of the songs you don't like.

That's where this instructable comes in. In this instructable, I will show you a way to automatically get rid of songs that are simply just plain awful, with some assistance from my good friend, Perl.

A good basic knowledge of Perl is extremely helpful when attempting to repeat this instructable, though not required (you could certainly just take the finished code product and copy/paste it and it will work just fine). For those interested in Perl, I highly recommend the book "Learning Perl" from O'Reilly, it's a good read and one of the best written books on Perl I have had the chance to read.

IMPORTANT: While the methods presented here will work if done correctly, I cannot and simply will not accept any responsibility if you do something stupid and delete your precious songs. Please strongly consider backing up your music files before attempting to write or execute a script such as the following. Just err on the side of caution so that we don't have any feelings hurt if you don't, thanks.

Read the warning? (Yes, even you, person who didn't read the warning) Great! Let's get started :-)

Update: It seems some perl scripters have been hard at work writing up iTunes scripts. For a variety of iTunes-related scripts, check out Teridon's Scripts.
 
Remove these adsRemove these ads by Signing Up
 

Step 1Getting Started

Getting Started
As with all things, there is a little preparation that needs to be done before we can run this script. So, things you will need to automatically delete songs from iTunes:
1) A computer (duh)
2) iTunes (double duh)
3) Perl (hard to run a Perl script without Perl, wouldn't you say?)
4) Your favorite editor (I'm a proponent of vi and vim myself, but any text editor should do the trick)
5) An iPod (not mandatory, but nice to have for reasons that will be made clear soon enough)

Getting Perl: Follow the instructions here, should be simple enough:
http://www.perl.com/download.csp

Once you have Perl downloaded, installed, and ready to go, we'll want some background information on what it is we're doing. It should be noted that the script was originally developed for Mac OS X, although the same methods should work on non-Unix based OSes such as Windows. Time for the boring, er, "educational" part of the Instructable.
« Previous StepDownload PDFView All StepsNext Step »
10 comments
Oct 23, 2008. 12:35 PMadmin says:
Hey, this is a great instructable and is very informative. Just one thing is missing... pictures! It really helps a lot when trying to follow directions so you should consider taking some photographs. Once you do that and leave me a message when you have so that we can publish your work. Thanks! Thanks for the cool instructable and we hope to publish this soon!
Feb 16, 2009. 6:37 PMbye-cycle says:
OK, I changed to the Perl Express editor and changed the LOG in line 30 to log. So now it runs thru the Run Continue ...but...I am getting something new. When I compile I am getting the following message - Usage: autodelete.pl -xml_file -log_file I hate making assumptions, but I am assuming that it wants the path to xml_file and log_file or I that need to create those files someplace so the program can find them. That or I am not compiling correctly. I am assuming (again) that your a MAC man(person) but hopefully you can point me in the right direction. Many thanks in advance.
Feb 17, 2009. 8:35 PMbye-cycle says:
OK I can do that ...but do I need to create those files first?? I have done a search and do not find xml_file or iTunes_file. If I do need to create them, what do I created them as, .txt or a .pl?? If I go to the iTunes folder I have files named iTunes Music Library.xml, and iTunes Library.itl. Thanks again
Feb 15, 2009. 3:46 PMbye-cycle says:
I am getting an error in line 30: Name "main::LOG" used only once: possibly typo at line 30. I have compared your supplied autodelete.txt to what I have typed and can't find a problem. Could you tell me where I have gone wrong??? Thanks in advance
Feb 15, 2009. 6:03 PMbye-cycle says:
I am more than happy to send you my script. And have done so...again many thanks
Oct 24, 2008. 5:24 PMjayhawker08 says:
first off, great instructable. clear instructions and does its job. however, wouldn't it be much easier for those of us that aren't programmers to just sort itunes by rating, select all 1-star songs, and then delete?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
22
Followers
13
Author:purduecer(NBitWonder)
When life gives me lemons, I make batteries. Check out my website at http://nbitwonder.com