I recently needed to convert a number of files in multiple directories from WAV format to MP3 format. I opted to do this with a script, seeing as most of the directories contained 99 files. Here is the bash script I came up with:
#!/bin/bash
SRCDIR=`pwd`
MP3DIR=$SRCDIR/mp3
for d in Disk*;
do
WORKDIR=$MP3DIR/"$d"
mkdir -p "$WORKDIR"
cd "$d"
for f in *.wav
do
b=`basename "$f" .wav`.mp3
lame -V2 "$f" "$WORKDIR/$b"
done
cd $SRCDIR
done
