script help - tagging from portion of folder name...


I think this is possible, but my scripting abilities are a bit weak.

My library is organized so that the top level folder is "artistname _XXX", where XXX is a 2 OR 3 digit number always preceded by the underscore. This number represents my own genre code and is always at the end of that top level folder.

What I'm trying to do is write a script that would determine that genre code and then apply it to the genre tag for all MP3's within that folder (including any subfolders).

Anyone have any tips on getting there?

Much appreciated!


Could you please give us a real-live example and the result how it should be?


So a sample folder is:
Keita, Mamady _113

within are 2 folders:
'89 +Sewa Kan]Wassalon
'95 Mogobalu

within those are the MP3's + JPG covers/info.txt

additionally, anther folder at the same level as M Keita, is:
Kankick]...from Artz Unknown _51

within that are the MP3's + JPG covers/info.txt

I would like to script something that scans for the "_" and takes the following number "113" or "51"
and applies that to the genre tag for the MP3s contained within. So for Keita, it would tag both albums, for Kankick it would tag the files within.

Those codes are always at the END of the folder names. Notice that the subfolders for Keita, do not contain the code - only the top level folder.

I hope this is clearer? Let me know and thanks!


I don't know how this could work for directories and subdirectories together, because they don't follow the same naming-syntax.

But if you try the following action just for your folder with the _nnn at the end (and not the subdirectories!) it should work:

Tag-Felder formatieren
Formatstring: $right(%_directory%,3)

Anyone else?