Copy Songs from your Ipod

Lauren’s iBook died recently and, with it, went all of her songs. I told her we could most likely recover the songs from her iPod so it shouldn’t be a big deal. However, as many of you probably know, you can’t simply restore your music library from your iPod. Thankfully, there is hope! Being the UNIX geek I am I whipped up a shell script to get all the songs of the iPod and it worked like a charm.


#!/bin/sh

IPODPATH=/Volumes/iPod/iPod_Control
DST=/tmp
TYPES="mp3 mp4 m4a m4b"

for ext in $TYPES
do
    find $IPODPATH -name *.$ext -print -exec cp {} $DST ;
done

I’m sure I’ll be getting a letter from Apple any time now, but there it is. Using simple UNIX commands you can easily recover the songs from your iPod. Maybe Apple will listen to it’s consumers and create an avenue to back up and recover one’s music library. Until then, UNIX is your friend. By the way, for those of you wondering, the m4b extension is for books. You may have other extensions on your iPod as well. To find what extensions you have I found the following command to be most helpful.


find /Volumes/iPod/iPod_Control/ -print | awk -F . '{print $2}' | sort | uniq

Of course you’ll need to change the names of the directories above to the actual name of your iPod (mine is simply named “iPod”). Once mounted it should show up in your /Volumes folder.

By the way, those of you with Cygwin installed should be able to use these scripts, after modifying the paths as well on your Windows iPods.

4 thoughts on “Copy Songs from your Ipod

  1. Find can handle multiple modifiers, and has basic AND/OR logic. So your script can be reduced to the single command:

    $ find /path -type f -name *.mp3 -or -name *.mp4 -or -name *.m4a -or -name *.m4b -exec cp {} /dest ;

    Note that the asterisks are backslashed. If they aren’t, the shell will glob them and screw up the find command if there are files with those extensions in the current directory.

    But we can use globbing to make our lives easier, too. We can reduce the command to:

    $ find /path -type f -name *.mp[34] -or -name *.m4[ab] -exec cp {} /dest ;

    The command to find the different extensions also has some problems, the most visible of which are that it will fail to work for files with periods in them, files with no extension, and it will show directories as well as files. A more accurate command would be:

    $ find /path -type f -exec basename {} ; | grep . | rev | cut -d. -f1 | rev | sort | uniq

  2. I recently bought your 40gb iPod and I was wondering if there was any way to do this for a PC?

  3. Actually, if the MP3’s have ID3 tags, which appear at the beginning of MP3 files or are AAC files from ITMS it retains song information just fine as the info is in the actual file.

    You are correct though that this does not retain any of your iTunes settings (ratings, playlists, etc.), but to say it doesn’t retain song information isn’t entirely true.

Leave a Reply

Your email address will not be published. Required fields are marked *