#! /bin/sh -e dir=none find /mnt/jb/master -type f -print | sort | while read line; do ok=t case "$line" in "$dir"/*/*) ;; "$dir"/*) continue ;; esac case "$line" in *.flac) if ! metaflac --list "$line" | grep -iq replaygain; then ok=nil fi ;; *.ogg) if ! vorbiscomment -l "$line" | grep -iq replaygain; then ok=nil fi ;; *.mp3) if ! mp3gain -s i -s c "$line" | grep -q "mp3 gain change"; then ok=nil fi ;; esac case $ok in nil) dir=${line%/*} echo "$dir" ;; esac done