#!/usr/bin/env bash ROOT="${1:-.}" find "$ROOT" -type d | while read -r dir; do first_file=$( find "$dir" -maxdepth 1 -type f \ \( -iname "*.m4b" -o -iname "*.m4a" -o -iname "*.mp3" \ -o -iname "*.flac" -o -iname "*.ogg" \) | sort | head -n1 ) [[ -z "$first_file" ]] && continue artist=$(kid3-cli -c "get artist" "$first_file" 2>/dev/null) album=$(kid3-cli -c "get album" "$first_file" 2>/dev/null) composer=$(kid3-cli -c "get composer" "$first_file" 2>/dev/null) comment=$(kid3-cli -c "get comment" "$first_file" 2>/dev/null) echo "====≠===============================" echo "Folder: $(basename "$dir")" echo "Album: $album" echo "Artist: $artist" echo "Narrator: $composer" echo "Comment: $comment" done