Parsing ID3 tags in Bash and renaming MP3s

First, let’s define a bunch of useful functions. We’ll later use these functions to extract the relevant sections of our ID3 tags. I’m going to assume you are using your interpreter directly, so lets copy & paste the following lines straight into your terminal:

Now lets say the current directory is full of MP3s that we would like to move to an appropriate folder and give a more appropriate filename (in my case, I had my corrupt old iPod from which I was attempting to extract all the music I could). The structure I’m aiming for is:

ARTIST – ALBUM / TRACK_NUMBER ARTIST – SONG_NAME

Making use of our functions defined above, this for loop ought to do the trick: