Delete Playlists AppleScript

I put together an AppleScript snippet to delete playlist files anywhere under the current directory. Some CD ripping software and music sharing sites include playlist files (*.m3u, *.pls) alongside audio files; if you drag a folder with audio files and playlist files, iTunes adds duplicate copies of the tracks. Solution: save this script as an application and drag it into your Finder toolbar; then run the app on the parent directory before you drag your new music into iTunes.

Basically it’s just running this command on your top-level Finder folder:

find $TARGET_DIR \( -name \*.pls -or -name \*.m3u \) -exec rm -f {} \;

Here’s the code; paste this into AppleScript Editor and save as an application, then you can drag it to your Finder toolbar (or wherever is a convenient place for you to launch it):

  • Brandon Orther

    I never realized how easy it is to add custom functionality to the Finder toolbar. Now an album is moved to NAS with playlist files removed and added to iTunes after a single click in Finder. You just saved me at least 48 seconds every time I get a new album. Thanks.