#!/bin/sh # This script should be launched from the root dir of music library. find . -name "*.m4a" | while read -r in; do out="../mp3/${in%.m4a}.mp3" dir="${out%/*}" test -d "$dir" && continue echo "$dir" mkdir -p "$dir" done find . -name "*.m4a" -exec ffmpeg -i {} -c:v copy -q:a 0 ../mp3/{}.mp3 \; exit