@terdon's answer provides this script:
find . -type f -name "*mp3" | while read file; do
album="$(basename "$(dirname "$file")")";
filename="$(basename "$file")";
artist=${filename%%-*};
title=${filename##*-};
title=${title%%.mp3};
eyeD3 -A "$album" -t "$title" -a "$artist" "$file";
done
It makes use of eyeD3
to update mp3 tags. It extracts Album, Artist and Title from file name, supposing that the file name is Album/Artist - Title.mp3
.
Well, after running it the Title field is starting with a blank space. See below:
How to fix this if my mp3 files have the pattern
Album/<Artist with possible spaces> - <track number> - <Title with possible spaces>.mp3