# Create filename with conditional parts

**URL:** https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345
**Category:** Support
**Created:** [May 19, 2022, 8:36am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345 "2022-05-19T08:36:30Z")
**Posts on this page:** 17
**Page:** 1

<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: [May 19, 2022, 8:36am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/1 "2022-05-19T08:36:30Z")

</div>

Did you know that you can filter for files where a particular field is missing with e.g.  
%mediatype% MISSING

Did you know that you can prepare the format string for the filename that the string part for MEDIATYPE is only used if there is data in MEDIATYPE?

Did you know that you can ease your work with a $if() function to fill any missing data with a dummy string?

---

<div class="post-metadata">

### Author: ![corky608](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@corky608](https://community.mp3tag.de/u/corky608)
#### Post date: [May 19, 2022, 8:39am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/2 "2022-05-19T08:39:22Z")

</div>

In a word NO I did not, thats all started to feel a bit deep lol, and in all honesty I didn't understand went straight over my head, I just figure stick with what I understand and if its empty input it manually. Cos your defiantely gonna be thinking wtf is she trying to do lmao

---

<div class="post-metadata">

### Author: ![corky608](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@corky608](https://community.mp3tag.de/u/corky608)
#### Post date: [May 19, 2022, 8:42am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/3 "2022-05-19T08:42:22Z")

</div>

if your prepared to write out an idiot proof how to with exactly what to write and where to put it, for an oap in training with many wtf moments in her life then please do 😃

---

<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: [May 19, 2022, 8:44am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/4 "2022-05-19T08:44:56Z")

</div>

What do you want to do first?  
Filter?  
You find the filter input box at the bottom of the window.  
Load all the files.  
Enter in the filter box:  
%mediatype% MISSING  
Now the list of files should only show those files where there is no data in MEDIATYPE.  
You may now enter something in your field.  
If it is the same for all files, you have now saved a lot of time, I would say.  
Press Ctrl-S to save the changes in the tag panel.

---

<div class="post-metadata">

### Author: ![corky608](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@corky608](https://community.mp3tag.de/u/corky608)
#### Post date: [May 19, 2022, 8:46am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/5 "2022-05-19T08:46:05Z")

</div>

Ok I got that one, I written it down 😃

---

<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: [May 19, 2022, 8:51am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/6 "2022-05-19T08:51:32Z")

</div>

I don't know if you will find something for MEDIATYPE for all files ...  
So, if you do not want to get something like  
"Europe - The Final Countdown - 1986 - ()"  
Then I would suggest that you modify

> [@How do I make a field from a tag source](https://community.mp3tag.de/t/how-do-i-make-a-field-from-a-tag-source/57341/9):
>
> Format string:  
> `%ALBUMARTIST% - %ALBUM% - %YEAR% - (%MEDIATYPE%)`

to  
`%ALBUMARTIST% - %ALBUM% - %YEAR%[- (%MEDIATYPE%)]`  
the square brackets work like an if-condition

---

<div class="post-metadata">

### Author: ![corky608](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@corky608](https://community.mp3tag.de/u/corky608)
#### Post date: [May 19, 2022, 9:36am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/7 "2022-05-19T09:36:37Z")

</div>

OH excellent, so I understand

if I write that in as it is, with the square brackets that would be instead of the one without square brackets, but would cover the case if no info in the required field

---

<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: [May 19, 2022, 9:59am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/8 "2022-05-19T09:59:29Z")

</div>

The square breackets would not appear in the output.

---

<div class="post-metadata">

### Author: ![corky608](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@corky608](https://community.mp3tag.de/u/corky608)
#### Post date: [May 19, 2022, 10:08am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/9 "2022-05-19T10:08:32Z")

</div>

ok, thank you.

I do have a couple more things you might be able to help with.

I have a few tracks that say something like

When You Believe (Theme From Prince Of Egypt) how can I change it so that it shows up as  
When You Believe [prince of egypt] so basically making it all lowercase within the brackets but also making it go from rounded to square brackets

---

<div class="post-metadata">

### Author: ![corky608](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@corky608](https://community.mp3tag.de/u/corky608)
#### Post date: [May 19, 2022, 10:29am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/10 "2022-05-19T10:29:32Z")

</div>

Doesn't matter I figured it out 😃 😜

Actually I have not only half of it 😐 thats what you get for blowing your own trumpet 😃

I've managed to make it look like

When You Believe [theme from prince of egypt] how do I make it remove the words "theme from"

---

<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: [May 19, 2022, 11:07am UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/11 "2022-05-19T11:07:23Z")

</div>

> [@corky608](#):
>
> When You Believe [theme from prince of egypt] how do I make it remove the words "theme from"

Replace "theme from" with nothing:

> [@Actions and batch-operations](https://community.mp3tag.de/t/actions-and-batch-operations/967/6):
>
> How to remove text strings? In order to remove text strings, create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group and choose Replace as action type. Field: Here you can enter which field(s) you want to change. You can choose \_ALL, which affects tags AND filenames, \_TAG which affects all tag fields, \_FILENAME which only affects the filename, or simply one of the other supported tag fields. Original: Here you enter the string that you want to delete. Replace with: Just leave this empty, bec…

---

<div class="post-metadata">

### Author: ![corky608](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@corky608](https://community.mp3tag.de/u/corky608)
#### Post date: [May 19, 2022, 12:01pm UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/12 "2022-05-19T12:01:36Z")

</div>

thank you 😃

I have successfully removed "theme from"

I blew my trumpet to quick, I thought I figured it out but I hadn't

I thought I had succeeded in lower case between brackets but I had not, it was lower case the entire filename, so I undid what I done

how do I make it look like this

the field is title

When You Believe [prince of egypt]

---

<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: [May 19, 2022, 12:23pm UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/13 "2022-05-19T12:23:19Z")

</div>

> [@corky608](#):
>
> From  
> When You Believe (Theme From Prince Of Egypt)  
> To  
> When You Believe [prince of egypt]

![image](https://community.mp3tag.de/uploads/default/original/2X/2/2b93e64fa7b2947a6bb4297b2020b6fab22743cc.png)

Format string:  
`$regexp(%TITLE%,(.*) \((.*)\),$1 '['\L$2']')`

Explanation:  
Search everything before a space and round opening bracket and put into capture group $1  
Search everything between and including the round opening bracket until and including the round closing bracket and put it into capture group $2

Replace it with the content of $1, followed by a space and opening square bracket, the content of $2 in lowercase and the closing square bracket.

I recommend to replace the string "theme from" in a second step and separate action for an easier understanding. 😉

---

<div class="post-metadata">

### Author: ![corky608](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@corky608](https://community.mp3tag.de/u/corky608)
#### Post date: [May 19, 2022, 12:31pm UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/14 "2022-05-19T12:31:12Z")

</div>

Your an absolute legend, thank you, and I will do what you suggested for the "theme from" bit etc 😃

---

<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: [May 19, 2022, 12:34pm UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/15 "2022-05-19T12:34:14Z")

</div>

Thanks.

Please be aware that regular expressions only works for the given examples.  
If your real title have more then one couple of round brackets or they only have an opening but no closing bracket, then this format string doesn't deliver the expected result.

Always check your data carefully before and after applying such a regular expression 😇 to ensure you get the expected result.

---

<div class="post-metadata">

### Author: ![corky608](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@corky608](https://community.mp3tag.de/u/corky608)
#### Post date: [May 19, 2022, 1:05pm UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/16 "2022-05-19T13:05:41Z")

</div>

Will do, and thank you again, hopefully I won't bother you all again lol, famous last words 😃

---

<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:29pm UTC](https://community.mp3tag.de/t/create-filename-with-conditional-parts/57345/17 "2026-02-09T12:29:46Z")

</div>


