A Linux shell script to rename files with a counter and copy them

As a brief note today, I was recently looking for all Messages/iMessage files that are stored on my Mac, and I used this shell script to copy all of those files — many of which have the same name — into a directory named tmpdir, giving them all new names during the copy process:

for i in `cat myfiles`
    fname=`basename $i`
    cp $i tmpdir/${count}-${fname}
    count=`expr $count + 1`

Amazon MP3 quality

A long time ago I wrote about how to improve your iTunes song quality, but that article was about how to make the songs you already have in iTunes sound their best through a couple of tweaks.

This morning I was again listening to a song on YouTube, and then I checked it against the same song I have in iTunes, and the YouTube song quality sounded better than my song, which I purchased through In short, that led me to find this amazon page where they discuss the (poor) quality of their MP3s, part of which is shown in this image. IMHO, I don’t think people are that concerned about 5 MB file sizes and 56k dialup connections in most places. (They could make this an option.)

MacOS: How to convert CAF sound files to AIF, MP3, WAV, AU, etc.

Mac CAF/AIF/MP3 sound file FAQ: How do I convert a CAF file to AIF format, MP3 format, or any other sound file format on Mac OS X, for free?

Convert CAF to AIF, MP3, WAV, for free - solution

While writing my Mac "Hide Your Desktop" application, I can't work with certain sound file formats yet, so I've been digging around trying to figure out how to convert Apple's "CAF" file format into a format I can deal with, and I really need files to be in an AIF, MP3, WAV, or AU format.

Last night I found a cool Mac OS X command-line utility named afconvert that lets you convert sound files from one format to another, for free. So I dug into it, and eventually created a shell script that lets me convert all my CAF sound files into AIF sound files. A slightly modified version of the same script will allow you to convert CAF or AIF sound files to MP3, WAV, and other sound file formats.

How to convert a DRM-protected song to an MP3

I've never bought any DRM protected (digital rights management) music, so although it's a well-known fact among techies, I didn't know until recently that you can burn DRM songs to a standard CD. The implication here is that once you've burned the DRM-protected song to CD, you can then rip it back as an MP3 file, which is the part that blows me away. Not much protection there, other than "security through obscurity".