Random Acts of Coding: Thinning out Duplicate Playlists

by Erica Sadun

Recently, my iPod has been collecting duplicate playlists like a child collects dirt. It's not an unknown problem. A bit of googling shows that others have had the same issue and as there didn't appear to be a simple solution, I decided to write a little script to take care of things. The following code deletes zombie playlists from the iPod. After, I re-sync to restore the playlists. This takes only a second because the iPod has already been synchronized before I run the script. Figlet, as you probably might guess, is the name of my iPod.

tell application "iTunes"
set Figlet to first source whose name is "Figlet"
set pls to every user playlist of Figlet
repeat with eachpl in pls
delete eachpl
end try
end repeat
end tell


Jake Jacobs
2007-08-04 14:12:30
This looks like it would solve a very prevalent and annoying problem of mine. I copy pasted this into Script Editor but when I click Run it says: Syntax Error: Can't get Jake's iPod. Access not allowed.
Erica Sadun
2007-08-04 18:14:19
Jake, could it be the name of your iPod? Spaces and apostrophes?
Jake Jacobs
2007-08-05 22:48:29
I changed the name of my ipod to Jpod and it solved all my problems thank you so much you're a godsend!
Ted Calbazana
2007-08-19 10:32:51
I just got my iPod to use with my Windows XP workstation. I do love it. What do I need to do to execute this code? I didn't know the iPod was programmable/sriptable. The duplicate playlist issue on my iPod is way bad. Please respond to my email at tcalbaz@yahoo.com

thank you,


oliver kuepfer
2007-09-16 12:01:42
Hi, I do have my IPod connected to Windows to. Now the question is, how do I get this VERY clever code to run for my IPod?
2008-06-03 09:46:33
Please help....I'm not sure what I need to do to run the script editor and fix my duplicate issue. Would you walk me through step by step? Thanks - Victoria