Music management

So, you’ve encoded all of your CDs (still illegal in the UK) onto your computer, or even a storage array, and you realise that the filenames don’t always match the track title.


This quick bash command will list the differences:


find <path> -iname \*.ogg -type f | while read FILE; do
    NAME="$( basename "$FILE" )"
    TITLE="$( ogginfo "$FILE" | \
        grep -i "title=" | cut -d"=" -f 2 )"
    if [ "$NAME" != "$TITLE" ]; then
        echo -e "$FILE\\t$TITLE"
done | tee titles.list


I’ll leave it as an exercise for the reader to parse this output to actually rename the files 😉