Sometimes there is the need to enumerate a large amount of files, which relate to different data media, e.g. album with 27 files stored on three CDs. It would be helpful to have a tag-field, automatically created into the track file, which holds the total amount of discs per album.

Today Mp3tag has no readymade built-in support for this purpose, but we are not lost at all.
We can use the Mp3tag services "export" and "actions" to proceed the enumeration automatically, to get the total values of tracks and discs, on a per album basis.


  1. Start Mp3tag and load the files to work with.
    The user must have write access to the folders and files. Files resp. their attributes must be set as writable.
    While the enumeration is running, the files get new tag-fields, which afterwards will be removed immediately by the action group. All files must have already set the tag-field DISCNUMBER to the corresponding physical disc number!

  2. Select all files from one album or from more albums.

  3. Run the export script “Export TXT Totaldiscs Totaltracks”.
    This will create the text file on the desktop: “Mp3tag.Export.txt”.
    Do not change the content of this file in any way!
    At end of the entire process, delete this file.
    This text file provides the input data for the following Mp3tag action script.

  4. Run the action group “Set Totaldiscs (run export script before!)”.
    This group of actions will create one tag-field TOTALDISCS.
    Alternatively run the action group “Set Totaldiscs Totaltracks (run export script before!)”.
    This group of actions will create two tag-fields TOTALDISCS and TOTALTRACKS.
    This overwrites all existing values in these tag-fields.
    Be aware of not destroying the content of the tag-field TOTALTRACKS, when you have set
    the value by other personal rules, for example:
    You have an album with 10 tracks overall, from which you have only 5 tracks on your disk, but you did set manually the tag-field TOTALTRACKS to the value 10 to be in order with the complete album. By executing this group of actions the tag-field TOTALTRACKS will be set to the number of the counted physical existing files, that gives the value 5.

  5. View the result within dialog “Extended tags…” … or … display %TOTALDISCS% within a dedicated column in the list view.

  6. Remove the file “Mp3tag.Export.txt” from desktop.

  7. Ready.

I did not verify this first attempt in full scope, so please feel free to report your experiences!

Download the attached zip file, which contains ...
Manual, MTE export script, MTA action groups, Test folder tree.
v1.00, ( 142.4K ) Number of downloads: 5
v1.01, ( 107.61K ) Number of downloads: 2
v1.02, (110 KB)

Edit. DD.20111201.1050.CET
Edit. DD.20111205.1812.CET (110 KB)

Thank you, I have actually been wondering about this for a while. If I understand this correctly, two new tags are created.
I have seen that in iTunes this information already exists, and so why is it necessary to create new tags? or does iTunes manipulate the information differently (I have seen that sometimes Tracknumbers are displayed as e.g. 4/13 when loading into mp3Tag.)
In any event, I am glad about your post and that a solution exists. :smiley: :rolleyes:

iTunes does not generate this information from scratch but reads that what is there.
DetlevD's script helps you to get this information initially so that iTunes can display it, too.
Also, the additional tag fields are, as DetlevD described, only included temporarily while the numbering is on the way, and are removed afterwards.

I just found this, and it's very slick! As I look at the details of how it works, I'd like to be clear on what tags need to be complete and accurate before using this.

I think I must have album and discnumber tags complete and accurate for all selected tracks, keeping in mind that if there is no DISCNUMBER tag, then this action group will assume the correct DISCNUMBER value should be 1.

Is my understanding accurate? thanks!

I just wanted to say I found this script very helpful! Thanks!

So I'm having a slight problem with this script - it works for most of my albums but not all of them and I believe the issue is when the album field (or the directory since the directory mimics the album name) contains a special character like parenthesis "(", ")", it doesn't seem to do the trick. Is anybody else running into this issue?

The detected misbehaviour can be confirmed. It seems that all those characters are forbidden for the album name resp. the directory name, which have to be escaped within a Mp3tag regular expression (for example ( ) [ ] , .).
Thanks for the note!


Okay, I'm glad I'm not alone on this issue. Do you happen to know how to fix this? I don't have the slightly clue on how to edit your regular expressions.

I am sorry to say ... oh no ... the end is open ... sometime next year perhaps.


How do i run the export script?

do i add it into the tools.

or file export?

How to install export configurations ... read there ...