# Write different file structure based on existence of disc tag

**URL:** https://community.mp3tag.de/t/write-different-file-structure-based-on-existence-of-disc-tag/11912
**Category:** Support
**Created:** [April 24, 2011, 6:54am UTC](https://community.mp3tag.de/t/write-different-file-structure-based-on-existence-of-disc-tag/11912 "2011-04-24T06:54:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mjc2264](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@mjc2264](https://community.mp3tag.de/u/mjc2264)
#### Post date: [April 24, 2011, 6:54am UTC](https://community.mp3tag.de/t/write-different-file-structure-based-on-existence-of-disc-tag/11912/1 "2011-04-24T06:54:02Z")

</div>

All my single disc albums have blank disc tags and get their file structure written from tag using:

\_DIRECTORY  
%artist%'['%year%']' %album%

For multi disc releases where the discnumber tag is populated, I'd like to write:

%artist%'['%year%']' %album%\%discnumber%

Is there a way to do this? I've been looking through the forums but can't find anything.

---

<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: [April 24, 2011, 9:06am UTC](https://community.mp3tag.de/t/write-different-file-structure-based-on-existence-of-disc-tag/11912/2 "2011-04-24T09:06:15Z")

</div>

> [@mjc2264](#):
>
> ... I've been looking through the forums but can't find anything.

This is very unfortunate for you, because the forum is very well stocked with all sorts of interesting contributions.  
The $if function is documented in the Mp3tag help manual, section Scripting Functions.

Regarding your example:

**$if(%DISCNUMBER%,'do this','do other')****$if(%DISCNUMBER%,%ARTIST%'\'['['%YEAR%'] ']%ALBUM%'\'%DISCNUMBER%,%ARTIST%'\'['['%YEAR%'] ']%ALBUM%)**

There is also an abbreviated scripting expression, which gives the same result:

**%ARTIST%'\'['['%YEAR%'] ']%ALBUM%['\'%DISCNUMBER%]**

DD.20110424.1315.CEST

---

<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: [April 25, 2011, 3:19pm UTC](https://community.mp3tag.de/t/write-different-file-structure-based-on-existence-of-disc-tag/11912/3 "2011-04-25T15:19:31Z")

</div>

> [@DetlevD](#):
>
> ... $if ...

Hi DetlevD  
Isn't it also an alternative to reformat the directory with a term in square brackets?

%artist%'['%year%']' %album%\%discnumber%\%title% -\>  
%artist%'['%year%']' %album%[\%discnumber%]\%title%

---

<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: [April 25, 2011, 3:58pm UTC](https://community.mp3tag.de/t/write-different-file-structure-based-on-existence-of-disc-tag/11912/4 "2011-04-25T15:58:25Z")

</div>

> [@ohrenkino](#):
>
> ... term in square brackets?

Hi ohrenkino, see my 'square bracket clamb' example in post #2, isn't it that what you mean?  
But how is your example related to the open poster's question?

DD.20110425.2000.CEST

---

<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: [April 25, 2011, 4:24pm UTC](https://community.mp3tag.de/t/write-different-file-structure-based-on-existence-of-disc-tag/11912/5 "2011-04-25T16:24:19Z")

</div>

> [@DetlevD](#):
>
> Hi ohrenkino, see my 'square bracket clamb' example in post #2

There must have been at least tomatoes on my eyes (good ole German colloquial ;-))  
Thank you for reassuring me.

---

<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/write-different-file-structure-based-on-existence-of-disc-tag/11912/6 "2026-02-09T12:23:03Z")

</div>


