#!/bin/bash # Adds replay gain tags to the entire music library # Run this at the root of the music library # Directory of your music library (change this if needed) MUSIC_DIR="." # Find all directories two levels deep (Artist/Album) containing FLAC files find "$MUSIC_DIR" -type f -iname "*.flac" -exec dirname {} \; | sort -u | while read -r album_path; do full_album_path="$MUSIC_DIR/$album_path" echo "Processing album: $full_album_path" # Run metaflac on all FLAC files in the album directory metaflac --add-replay-gain "$full_album_path"/*.flac done