# Simple Filename to Tag Problem

**URL:** <https://community.mp3tag.de/t/simple-filename-to-tag-problem/12333>\
**Category:** Support\
**Created:** [July 26, 2011, 4:51pm UTC](https://community.mp3tag.de/t/simple-filename-to-tag-problem/12333 "2011-07-26T16:51:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eraemia](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/cdc98d/32.png) [@eraemia](https://community.mp3tag.de/u/eraemia)\
**Post date:** [July 26, 2011, 4:51pm UTC](https://community.mp3tag.de/t/simple-filename-to-tag-problem/12333/1 "2011-07-26T16:51:43Z")

</div>

Hello everyone,

**Here is my filename:**  
101 - Sonata No. 1 in F minor, Op. 6, I. Allegro con fuocoso.mp3

**I'm trying to get the following into the tag:**  
Disc number: 1  
Track: 01  
Title: Sonata No. 1 in F minor, Op. 6, I. Allegro con fuocoso

**But none of the following format strings work:**  
%discnumber%$num(%track%,2) - %title%  
$num(%discnumber%,1)$num(%track%,2) - %title%

What am I doing wrong? Please advise.

-Nathan

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 26, 2011, 5:05pm UTC](https://community.mp3tag.de/t/simple-filename-to-tag-problem/12333/2 "2011-07-26T17:05:12Z")

</div>

> [@eraemia](#):
>
> 101 - Sonata No. 1 in F minor, Op. 6, I. Allegro con fuocoso.mp3  
> I'm trying to get the following into the tag:  
> Disc number: 1  
> Track: 01  
> Title: Sonata No. 1 in F minor, Op. 6, I. Allegro con fuocoso

Try to do it in some more steps.  
First, use the converter filename - tag and put the complete first number into the tag TRACK, so that it contains e.g. 101  
The create 2 actions of the type "format tag field", one to format DISCNUMBER with the formatstring:  
$div(%track%,100)  
This gives you the result of the division as an integer, in this case "1".  
Then the same type for TRACK:  
$mod(%track%,100)  
This gives you the remainder of the division of 101 by 100.  
These two actions in one action group work for all joint disc/tracknumbers up to 999, that is 9 discs with 99 tracks each.

---

<div class="post-metadata">

**Author:** ![eraemia](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/cdc98d/32.png) [@eraemia](https://community.mp3tag.de/u/eraemia)\
**Post date:** [July 26, 2011, 5:27pm UTC](https://community.mp3tag.de/t/simple-filename-to-tag-problem/12333/3 "2011-07-26T17:27:33Z")

</div>

> [@ohrenkino](#):
>
> Try to do it in some more steps.  
> First, use the converter filename - tag and put the complete first number into the tag TRACK, so that it contains e.g. 101  
> The create 2 actions of the type "format tag field", one to format DISCNUMBER with the formatstring:  
> $div(%track%,100)  
> This gives you the result of the division as an integer, in this case "1".  
> Then the same type for TRACK:  
> $mod(%track%,100)  
> This gives you the remainder of the division of 101 by 100.  
> These two actions in one action group work for all joint disc/tracknumbers up to 999, that is 9 discs with 99 tracks each.

Thanks for your suggestion, ohrenkino. Since it seems like one has to resort to roundabout methods, I ended up using regex to solve the problem:

**Parse out disc number with the following \_FILENAME action:**  
(\d)(\d+) - (.+) --\> $1 - $2 - $3

**Filename to tag:**  
%discnumber% - %track% - %title%

**Revert filename changes with the following action:**  
(\d) - (\d+) - (.+) --\> $1$2 - $3

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [July 27, 2011, 4:34am UTC](https://community.mp3tag.de/t/simple-filename-to-tag-problem/12333/4 "2011-07-27T04:34:41Z")

</div>

> [@ohrenkino](#):
>
> ... $div(%track%,100) ... $mod(%track%,100) ... work for all joint disc/tracknumbers up to 999, that is 9 discs with 99 tracks each.

Please check this statement again, it should be possible to address more than 9 discs.

DD.20110727.0837.CEST

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [July 27, 2011, 4:51am UTC](https://community.mp3tag.de/t/simple-filename-to-tag-problem/12333/5 "2011-07-27T04:51:55Z")

</div>

> [@eraemia](#):
>
> ... **Here is my filename:**  
> 101 - Sonata No. 1 in F minor, Op. 6, I. Allegro con fuocoso.mp3  
> **I'm trying to get the following into the tag:**  
> Disc number: 1  
> Track: 01  
> Title: Sonata No. 1 in F minor, Op. 6, I. Allegro con fuocoso  
> ...

You can use this ....

Begin Action Group **Test\_2011#20110727.TagFieldImport** 

Action #1  
_Actiontype 7:_ **Import tag fields (guess values)**  
_Source format:_

 **$div($num(%\_filename%,1),100)' - '$num($mod($num(%\_filename%,1),100),2)$trimLeft(%\_filename%,'0123456789')** 

_Guessing pattern:_ **%DISCNUMBER%÷-÷%TRACK%÷-÷%TITLE%**

 

_Note: Replace each special ÷ character with one space character._  
End Action Group **Test\_2011#20110727.TagFieldImport** (1 Action)

 

From:  
\_FILENAME = 101 - Sonata No. 1 in F minor, Op. 6, I. Allegro con fuocoso.mp3  
To:  
DISCNUMBER = 1  
TRACK = 01  
TITLE = Sonata No. 1 in F minor, Op. 6, I. Allegro con fuocoso

 

DD.20110727.0900.CEST

---

<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:23pm UTC](https://community.mp3tag.de/t/simple-filename-to-tag-problem/12333/6 "2026-02-09T12:23:14Z")

</div>


