Count number of folders in parent directory?

My folder structure is as follow:

...</b>Artist 1</b>Artist 1 - Album 1</b>
...</b>Artist 1</b>Artist 1 - Album 2</b>
...</b>Artist 1</b>Artist 1 - Album 3</b>Disc 01</b>
...</b>Artist 1</b>Artist 1 - Album 3</b>Disc 02</b>
...</b>Artist 1</b>Artist 1 - Album 3</b>Disc 03</b>
...</b>Artist 1</b>Artist 1 - Album 4</b>

Is there a way to count the number of folders present in the parent directory?
Something like:
$if($eql($left(%_directory%,5),Disc ),[COUNT # OF FOLDERS IN PARENT & SET TOTALDISCS],[SET TOTALDISCS TO 1])

There is no proper way in the interactive interface of Mp3tag, but you may create an export script, which can count the folders, like this example script ...

1: $filename($getEnv('USERPROFILE')'\Desktop\Mp3tag.Export.txt',UTF-8)

2: $loop($folderdepth(%_folderpath%))
3: 'Folderdepth: '$folderdepth(%_folderpath%)
4: $loop(%_directory%,1)
5: %_parent_directory%'|'%_directory%
6: $loopend()
7: 'Folder count: '%_max_counter%
8: $loopend()
9: 'Folderpath count: '%_max_counter%


You may check out the method there ...


I was hoping to find a way so I can use it with Action -> Format Value since I need it to to set the TOTALDISCS tag. Exporting to a text file is pretty useless for what I want to achieve. <_<

Harsh words.
I assume that you do know the action "Import data from text file"?
If you store the totaldiscs in a text file, you can easily retrieve it from there and import it to the selected files.
Reconsider "useless".

You can do it as a 2-step method by using 2 actiongroups.
Step 1. Export the calculated or cumulated data via report output to text file.
Step 2. Import the data from the text file into the related tag-fields.