# Nested conditional assistance for renaming of audiobooks

**URL:** https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604
**Category:** Support
**Created:** [September 2, 2025, 10:29am UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604 "2025-09-02T10:29:08Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Nolaine](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/f0a364/32.png) [@Nolaine](https://community.mp3tag.de/u/Nolaine)
#### Post date: [September 2, 2025, 10:29am UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/1 "2025-09-02T10:29:08Z")

</div>

I’m trying to rename audiobook files. This is what I want it to look like:

_(book not in a series)_  
`Author - Title (year) [isbn] {###Kbps}`

_(book in a series but with a null series-part)_  
`Author - Series - Title (year) [isbn] {###Kbps}`

_(book in a series with valid series-part)_  
`Author - Series ## - Title (year) [isbn] {###Kbps}`

Series part should be padded with a leading zero for values under 10.

Using[this topic](https://community.mp3tag.de/t/audiobook-file-naming-from-the-series-and-series-part-fields-if-statement/63443/8) from last year, I came up with this:

`$if($and(%series%,$and(%series-part%,$less(%series-part%,10))),%artist% - %series% 0%series-part% - %album% (%year%) [%asin%] {%bitrate%},$if($and(%series%,%series-part%), %artist% - %series% %series-part% - %album% (%year%) [%asin%] {%bitrate%}),%artist% - %album% (%year%) [%asin%] {%bitrate%})`

But it’s not right, and I’m not sure exactly what logic I should be using instead of all the nested(if A and B) conditions. It’s also sort of repetitive.

---

<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 2, 2025, 10:36am UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/2 "2025-09-02T10:36:50Z")

</div>

I don't know what you mean by

> [@Nolaine](#):
>
> book in a series but with a null series-part

How does that differ from

> [@Nolaine](#):
>
> book not in a series

In any case: To write the filename, use the square brackets for any part that should only appear if there is data for the field, e.g.  
`%Author%[- Series $num(%series%,2)] - %Title% (%year%) '['%isbn%']' {%_bitrate%Kbps}`  
This should work for the first and the third case.

---

<div class="post-metadata">

### Author: ![Nolaine](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/f0a364/32.png) [@Nolaine](https://community.mp3tag.de/u/Nolaine)
#### Post date: [September 2, 2025, 10:43am UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/3 "2025-09-02T10:43:30Z")

</div>

The two differ because sometimes a series exists in which it’s not necessary to read the series in a particular order, such as situations where books in a series are loosely related to each other, but can each be read as standalones. Or perhaps there is an anthology of shorts that doesn’t actually belong in one particular point in the series. So the books still belong to a series (i.e. `%series%` is not null, there just is no value in the field where normally you’d see `%series-part%`

And than you, the square brackets were what I wasn’t getting in those cases.

---

<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 2, 2025, 10:46am UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/4 "2025-09-02T10:46:48Z")

</div>

> [@Nolaine](#):
>
> there just is no value in the field

AFAIK there is no "empty" field. Fields without value do no exist. So i wonder how you find out what a missing field SERIES means: is it a single book or one of the loosely connected ones?

---

<div class="post-metadata">

### Author: ![Nolaine](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/f0a364/32.png) [@Nolaine](https://community.mp3tag.de/u/Nolaine)
#### Post date: [September 2, 2025, 11:00am UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/5 "2025-09-02T11:00:39Z")

</div>

I’m sorry, I’m not sure I understand the question. Or I think we’re both talking about the same thing using different language maybe?

I’m referring the the %%series-part% field not having a value in it (i.e. the metadata is missing that particular tag, otherwise field it would at least have a zero value, right?)

So basically, I’m looking for a way to express if the series part is null, which your solution with the brackets does by only including that part if it exists.

---

<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 2, 2025, 11:30am UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/6 "2025-09-02T11:30:45Z")

</div>

If SERIES is always filled if there is a series, only that for some the value is `0`, and you do not want to see the `0`, only the word series, then the expression could look like this:  
`%Author%[- Series$replace( $num(%series%,2),00,)] - %Title% (%year%) '['%isbn%']' {%_bitrate%Kbps}`

---

<div class="post-metadata">

### Author: ![Nolaine](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/f0a364/32.png) [@Nolaine](https://community.mp3tag.de/u/Nolaine)
#### Post date: [September 2, 2025, 8:11pm UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/7 "2025-09-02T20:11:20Z")

</div>

I think maybe I’m not being explicit that `%series-part%` is a different field/tag than `%series%`. `%series%` is the name of a series. `%series-part%` is that specific book’s position within the series. Thank you for trying to help me figure it out, though.

---

<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 2, 2025, 8:12pm UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/8 "2025-09-02T20:12:36Z")

</div>

That is why real data, preferably presented with screenshots is usually a good approach.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [September 2, 2025, 8:44pm UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/9 "2025-09-02T20:44:18Z")

</div>

This one should be giving the expected filenames:

```plaintext
%ALBUMARTIST%[- %SERIES%][$num(%SERIES-PART%,2)] - %ALBUM% (%YEAR%)['['%ASIN%']'] {%_BITRATE%Kbps}

```

---

<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: [October 2, 2025, 8:45pm UTC](https://community.mp3tag.de/t/nested-conditional-assistance-for-renaming-of-audiobooks/69604/10 "2025-10-02T20:45:16Z")

</div>

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