# How to remove Discnumber Tag if album has only 1 CD but not if there are more?

**URL:** https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288
**Category:** Support
**Created:** [December 14, 2019, 7:01am UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288 "2019-12-14T07:01:54Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Elco](https://community.mp3tag.de/user_avatar/community.mp3tag.de/elco/32/7076_2.png) [@Elco](https://community.mp3tag.de/u/Elco)
#### Post date: [December 14, 2019, 7:01am UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/1 "2019-12-14T07:01:54Z")

</div>

Hi. I ripped a bunch of CDs and the software automatically filled up the discnumber field. I see a "1" if the album has only 1 CD and "2" if there are 2 discs, so on and so forth. Using MP3Tag to check the metadata, the "disctotal" field is absent.

I'd like to create an ACTION that will delete the discnumber tag (or make it blank) if the album has only one CD but keep it if there are two discs or more.

How do I do this? Thanks in advance!

---

<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: [December 14, 2019, 8:52am UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/2 "2019-12-14T08:52:41Z")

</div>

I don't think that it is possible if there is no hint in the available data that no further discs follow.  
It could work the other way round: if you find those files where there are more than one album, you could use the track numbering assistant and set the field DISCNUMBER including the total number of discs. As this would lead to a number like  
`1/3`  
you could filter for those that do not have the slash as part of DISCNUMBER and delete the field for those.  
MP3tag does not know anything about the surrounding tracks but sees only the currently treated one, so MP3tag cannot tell whether there are more discs to come.

---

<div class="post-metadata">

### Author: ![Elco](https://community.mp3tag.de/user_avatar/community.mp3tag.de/elco/32/7076_2.png) [@Elco](https://community.mp3tag.de/u/Elco)
#### Post date: [December 14, 2019, 9:05am UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/3 "2019-12-14T09:05:34Z")

</div>

Thanks for the suggestion. I was hoping there was a way that MP3Tag could look at the album name and if the discnumber of that album is limited to "1," then make that tag blank. Otherwise, do nothing.

---

<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: [December 14, 2019, 9:15am UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/4 "2019-12-14T09:15:05Z")

</div>

> [@Elco](#):
>
> look at the album name and if the discnumber of that album is limited to "1,"

This would delete all entries with a "1" as MP3tag does not know whether a "2", "3" or more will follow.  
This mechanism would also require to have a look at the artist as there are so many "Best of" and "Greatest Hits" albums around.

---

<div class="post-metadata">

### Author: ![Elco](https://community.mp3tag.de/user_avatar/community.mp3tag.de/elco/32/7076_2.png) [@Elco](https://community.mp3tag.de/u/Elco)
#### Post date: [December 14, 2019, 9:18am UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/5 "2019-12-14T09:18:58Z")

</div>

You have a point.

My CD ripping software saves albums in separate folders. Perhaps there is a way for MP3Tag to look at the songs in that folder, and if the discnumber tag of the songs is just "1," then make that tag blank. Otherwise do nothing.

---

<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: [December 14, 2019, 9:55am UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/6 "2019-12-14T09:55:26Z")

</div>

This would still mean that you compare 2 files: one from the CD 1 folder and one from the CD 1+x folder. And this is what does not work.  
If the ripping software saves the discnumber and the total in the path somewhere, it should be possible to retrieve this information. It will not work if the path says only  
CD1  
and not  
CD 1\_2

If the ripper only creates a "CDx" folder if there are more than one disc, one could filter for those files that do not have that folder with  
`NOT %_path% MATCHES "\\CD\d+"`

---

<div class="post-metadata">

### Author: ![bhallnerd](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ee59a6/32.png) [@bhallnerd](https://community.mp3tag.de/u/bhallnerd)
#### Post date: [December 14, 2019, 7:05pm UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/7 "2019-12-14T19:05:15Z")

</div>

I'm not sure what you are trying to accomplish with this as having the DISCNUMBER is actually considered having complete song metadata. That being said, you could see the Disc being displayed as 1 or 1/1 or 1/2 or being blank etc. There is also an extended TAG that is used known as TOTALDISCS. in this tag you could see 1 or 2 or blank etc. (Note the TOTALDISCS is not used with all file types but is included and used with MP3 and M4A file types)  
AS MP3Tag does not go out and read data outside of what it finds saved within the file you would need to create an action that would modify and save the metadata.  
In English it would be something like:  
IF (DISCNUMBER = 1 AND TOTALDISCS = 1) THEN DISCNUMBER = NULL OR DISCNUMBER = 1/1 THEN DISCNUMBER = NULL ELSE DISCNUMBER = DISCNUMBER

---

<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: [December 14, 2019, 7:31pm UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/8 "2019-12-14T19:31:47Z")

</div>

> [@bhallnerd](#):
>
> There is also an extended TAG that is used known as TOTALDISCS

I do not see a field called TOTALDISCS anywhere in the list of supported fields:

> **[Tag Field Mappings – Mp3tag Documentation](https://docs.mp3tag.de/mapping/)**
>
> Overview of all available tag fields, their names in Mp3tag, and how they are mapped to the internal structures of the different tag formats. Mp3tag is the universal Tag Editor.

So, a field called TOTALDISCS would be a user-defined field, not an extended tag field.  
It may be that other programs split the field DISCNUMBER and display the disc and the total number of discs separately.

---

<div class="post-metadata">

### Author: ![Elco](https://community.mp3tag.de/user_avatar/community.mp3tag.de/elco/32/7076_2.png) [@Elco](https://community.mp3tag.de/u/Elco)
#### Post date: [January 6, 2020, 7:51am UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/9 "2020-01-06T07:51:23Z")

</div>

Follow-up question. I want to add the number of CDs to the **name of the folder** that contains the album, but only if that album has more than one CD.

For example, the 2002 album of Elton John's Greatest Hits has three CDs, as identifed in the %discnumber% tag. So I want the name of the folder to say _**Elton John - Greatest Hits (3CD)**_.

How can I do this? Thanks in advance!

---

<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: [January 6, 2020, 8:32am UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/10 "2020-01-06T08:32:46Z")

</div>

if DISCNUMBER says only 1, 2, 3 then it will not really work as MP3tag does not compare tags.  
if DISCNUMBER looks like 1/3, 2/3, 4/3, then you can extract the number of discs with  
$mid(%discnumber%,$add($strchr(%discnumber%,/),1),$len(%discnumber%))  
And perhaps an action of the type "Format value" for \_DIRECTORY will do:  
Format string: `%_DIRECTORY%[$mid(%discnumber%,$add($strchr(%discnumber%,/),1),$len(%discnumber%))CD]`  
or perhaps a little less complicated:  
Format string: `%_DIRECTORY%[$regexp(%discnumber%,\d\/,)CD]`

---

<div class="post-metadata">

### Author: ![lightniningsteve7](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/49beb7/32.png) [@lightniningsteve7](https://community.mp3tag.de/u/lightniningsteve7)
#### Post date: [April 19, 2025, 1:41pm UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/11 "2025-04-19T13:41:16Z")

</div>

$if($eq(%totaldiscs%,1),$unset(discnumber)$unset(totaldiscs))  
The above is not working for me. I try to clean the mess when totaldiscs is 1 so i would like to flush discnumber and then totaldiscs value to empty.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [April 19, 2025, 1:53pm UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/12 "2025-04-19T13:53:44Z")

</div>

> [@lightniningsteve7](#):
>
> $if($eq(%totaldiscs%,1),$unset(discnumber)$unset(totaldiscs))

Where did you get this Format string?  
This is not a valid Mp3tag syntax (maybe from MusicBrainz Picard?).

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

There is no such command as `$eq`, but `$eql`.  
There is no such command as `$unset`.

If you look at the [mapping table](https://docs.mp3tag.de/mapping/) you can see that TOTALDISCS is only valid for MP4.  
To remove the DISCNUMBER for example, you could use Convert Tag -\> Tag  
Field: DISCNUMBER  
Format string:  
`$if($eql(%discnumber%,1),,%discnumber%)`

This means:  
If the content of DISCNUMBER for the current track is equal to 1, then set the new content for DISCNUMBER to "nothing" = delete it.  
Otherwise - if the DISCNUMBER is NOT equal to 1 - leave it as it is = unchanged.

---

<div class="post-metadata">

### Author: ![lightniningsteve7](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/49beb7/32.png) [@lightniningsteve7](https://community.mp3tag.de/u/lightniningsteve7)
#### Post date: [April 19, 2025, 9:45pm UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/13 "2025-04-19T21:45:11Z")

</div>

I found that the following is working for my need. it bulk remove all single disc tag but keep dual disc or more intact. I have the custom field TOTALDISCS enable.  
Format Value  
Field: DISCNUMBER  
Format String: `$if($eql(%totaldiscs%,1),,%discnumber%)`

---

<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: [May 19, 2025, 9:46pm UTC](https://community.mp3tag.de/t/how-to-remove-discnumber-tag-if-album-has-only-1-cd-but-not-if-there-are-more/47288/14 "2025-05-19T21:46:02Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
