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

**URL:** https://community.mp3tag.de/t/script-help-tagging-from-portion-of-folder-name/5018
**Category:** Support
**Created:** [June 15, 2007, 1:31pm UTC](https://community.mp3tag.de/t/script-help-tagging-from-portion-of-folder-name/5018 "2007-06-15T13:31:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mjm716](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@mjm716](https://community.mp3tag.de/u/mjm716)
#### Post date: [June 15, 2007, 1:31pm UTC](https://community.mp3tag.de/t/script-help-tagging-from-portion-of-folder-name/5018/1 "2007-06-15T13:31:32Z")

</div>

Hi,

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!

.Mike

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [June 15, 2007, 1:49pm UTC](https://community.mp3tag.de/t/script-help-tagging-from-portion-of-folder-name/5018/2 "2007-06-15T13:49:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mjm716](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@mjm716](https://community.mp3tag.de/u/mjm716)
#### Post date: [June 15, 2007, 2:03pm UTC](https://community.mp3tag.de/t/script-help-tagging-from-portion-of-folder-name/5018/3 "2007-06-15T14:03:49Z")

</div>

Sure,

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!

.M

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [June 15, 2007, 4:08pm UTC](https://community.mp3tag.de/t/script-help-tagging-from-portion-of-folder-name/5018/4 "2007-06-15T16:08:18Z")

</div>

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  
Feld: GENRE  
Formatstring: $right(%\_directory%,3)

Anyone else?

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:20pm UTC](https://community.mp3tag.de/t/script-help-tagging-from-portion-of-folder-name/5018/5 "2026-02-09T12:20:21Z")

</div>


