# Conditional tag to file name depending on disctotal

**URL:** <https://community.mp3tag.de/t/conditional-tag-to-file-name-depending-on-disctotal/50305>\
**Category:** Support\
**Created:** [September 27, 2020, 10:14pm UTC](https://community.mp3tag.de/t/conditional-tag-to-file-name-depending-on-disctotal/50305 "2020-09-27T22:14:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![goo](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@goo](https://community.mp3tag.de/u/goo)\
**Post date:** [September 27, 2020, 10:14pm UTC](https://community.mp3tag.de/t/conditional-tag-to-file-name-depending-on-disctotal/50305/1 "2020-09-27T22:14:25Z")

</div>

Hi, I would like the tag to file name button to do different things depending on if the album has more than one disc.

if disctotal\>1 use:  
%discnumber%-$num(%track%,2). %title%

else use:  
$num(%track%,2). %title%

I just don't know how to put it in code.

---

<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:** [September 28, 2020, 4:32am UTC](https://community.mp3tag.de/t/conditional-tag-to-file-name-depending-on-disctotal/50305/2 "2020-09-28T04:32:53Z")

</div>

For Mp3 files I think such an expression could work as a replacement for

> [@goo](#):
>
> if disctotal\>1 use:  
> %discnumber%-

`$ifgreater($regexp(%discnumber%,'^\d+\/',),1,$num(%discnumber%,1)-,)`

---

<div class="post-metadata">

**Author:** ![goo](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@goo](https://community.mp3tag.de/u/goo)\
**Post date:** [September 28, 2020, 10:14am UTC](https://community.mp3tag.de/t/conditional-tag-to-file-name-depending-on-disctotal/50305/3 "2020-09-28T10:14:12Z")

</div>

I think the first %discnumber% should be %disctotal%

e.g.  
`$ifgreater($regexp(%disctotal%,'^\d+\/',),1,$num(%discnumber%,1)-,)`

So putting both together:  
`$ifgreater($regexp(%disctotal%,'^\d+\/',),1,$num(%discnumber%,1)-,)$num(%track%,2). %title%`

That seems to work great with the quick tests I did, thank you!

I'm using FLACs but I don't think it makes a difference?

---

<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:** [September 28, 2020, 10:17am UTC](https://community.mp3tag.de/t/conditional-tag-to-file-name-depending-on-disctotal/50305/4 "2020-09-28T10:17:05Z")

</div>

> [@goo](#):
>
> I'm using FLACs but I don't think it makes a difference?

I think it does because mp3s have the disc number and the totals in just one field that gets addressed the way I wrote it.

---

<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:28pm UTC](https://community.mp3tag.de/t/conditional-tag-to-file-name-depending-on-disctotal/50305/5 "2026-02-09T12:28:51Z")

</div>


