I have a bunch of mp3 and when I import them in Banshee, it's all messed up. The mp3 files I have are organized by folder and I would like to make the folder name as the album tag for the mp3, so that I can sort them easily in Banshee.

I tried easytag and audio tag tool, but was not able to figure it out. Could anyone provide me with instructions for making the folder name as album tag for mp3 in batch?

BTW, I am using Ubuntu 11.10.

Edit: For some reason which I am not aware of, the below solution of using tagmp3 doesn't work for me neither using the script or the tagmp3 directly from the terminal.


You can use id3v2.

If it is not there install it..

apt-get install id3v2

Try this

find . | grep .mp3$ > /tmp/flist

while read line    
  id3v2 --album "$folder" "$file"

done < /tmp/flist
  • id3v2 works, but I like the other script without any file direction to a temporary file first. – Praveen Sripati Jan 12 '12 at 14:04

This is not easy. But I hope this helps. Save the script in a file and use chmod +x to make the file executable. Use ./filename to execute.

Be aware that before executing you need to specify in which folder you want to search. The script will go trough all subdirectories.

The script is provided as is. So test it and make a backup before, but it should work.

First install tagmp3

sudo apt-get install mpgtx


for f in $(find /home/username/music/ -type f -name "*.mp3")
    tagmp3 set "%a:$dironly" "$f"
  • You should probably double quote $f too. – slhck Jan 5 '12 at 14:17
  • tested and done. – persec Jan 5 '12 at 14:59
  • The script didn't work. I checked the properties on the mp3 file. Ran the tagmp3 set "%a:folder" folderName from the terminal and still no change. – Praveen Sripati Jan 5 '12 at 15:18
  • if you use tagmp3 directly it is tagmp3 set "%a:foldername" filename I've tested this on my machine using ubuntu 11.10. – persec Jan 5 '12 at 15:44

I haven't tried it myself, but puddletag is a clone of mp3tag (which i use the hell out of), and is a graphical tagging software for MP3s and other music files. I believe that specifically you need to use the filename to tag feature or scripting.

I'll update my answer when i next use a linux system, and get this installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.