#!/bin/bash # Sets Artist and AlbumArtist tags to arg for all .flac in . recursively. artist=$1 # Ensure metaflac is installed if ! command -v metaflac &> /dev/null; then echo "metaflac is required but not installed. Exiting." exit 1 fi # Find and update all .flac files recursively find . -type f -iname "*.flac" | while IFS= read -r flac; do echo "Updating tags in '$flac'..." metaflac --remove-tag=ALBUMARTIST --remove-tag="ALBUM ARTIST" --remove-tag="ALBUM_ARTIST" "$flac" metaflac --set-tag="ALBUMARTIST=$artist" "$flac" metaflac --remove-tag=ARTIST "$flac" metaflac --set-tag="ARTIST=$artist" "$flac" done echo "All matching FLAC files updated."