#!/bin/bash for d in ./*; do if [ -d "$d" ]; then f=${d:2} cd "$d" echo ${f}.mp3 mp3cat -c 1 ./*.mp3 -o "${f}.mp3" mv "${f}.mp3" ../ cd .. fi done