# Help with the renaming template

**URL:** <https://community.mp3tag.de/t/help-with-the-renaming-template/52965>\
**Category:** Support\
**Created:** [April 25, 2021, 10:34am UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965 "2021-04-25T10:34:28Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)\
**Post date:** [April 25, 2021, 10:34am UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/1 "2021-04-25T10:34:28Z")

</div>

I need to rename the subfolder CD, which has the following explanations

CD1 - Album

%artist%%year% - %album%\CD%discnumber% - %discsubtitle%%dummy%

So it turns out

But if there is no explanation in the name of the folder with a title "CD", then the script does not work, how to do it for both options at the same time

\*I don't know where the backslash went

---

<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, 2021, 10:47am UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/2 "2021-04-25T10:47:29Z")

</div>

> [@Mrakobes666](#):
>
> %artist%%year% - %album%\CD%discnumber% - %discsubtitle%%dummy%

If you enclose the part which could be there or be absent in square brackets, you have some kind of IF condition:  
`%artist%\%year% - %album%\[CD%discnumber% -]%discsubtitle%%dummy%`  
The use of `%dummy%` does not make any sense when writing a filename.

---

<div class="post-metadata">

**Author:** ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)\
**Post date:** [April 25, 2021, 1:53pm UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/3 "2021-04-25T13:53:56Z")

</div>

Your idea about square brackets is clear and correct, but it does not work (((( I tried different combinations of parenthesis and the second part, including

[![](https://community.mp3tag.de/uploads/default/original/2X/9/911deccb31691543847dbccc66e79ade608bf104.jpeg)](https://i114.fastpic.ru/big/2021/0425/ef/746b3990d477a2ad620ff08975708eef.png)  
[![](https://community.mp3tag.de/uploads/default/original/2X/4/49f4c6bd5c2baaf20bddb1b8d1c347539dd7999e.jpeg)](https://i114.fastpic.ru/big/2021/0425/9d/f83d0fe9ce2c0aaa77f90f378ae0629d.png)  
[![](https://community.mp3tag.de/uploads/default/original/2X/6/623db49dedcacf12da0b1d48243ffd9d7386ca65.jpeg)](https://i114.fastpic.ru/big/2021/0425/b4/f521899fbaa89c1b83952fe754196bb4.png)

Without a dummy substitution if there are files inside the last folder it doesn't work at all

---

<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, 2021, 3:18pm UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/4 "2021-04-25T15:18:55Z")

</div>

I agree that the way that you applied the format string does not work at all.  
If you want to rename a folder, you have to use  
Converter\>Tag-Tag  
or  
Action "Format value"  
for \_DIRECTORY

This renames the folder and therefore also moves all the files in that folder to the new location.  
If the number of source folders is smaller than the number of target folders, then you have to define for each file where it should belong. Then you have to use  
Converter\>Tag-Filename  
with a mask that also defines the filename ("%dummy%" in this respect means "nothing" and empty filenames are not allowed)  
Alternatively, Converter\>Tag-Tag or Action "Format value" for \_FILENAME, also with a mask that defines the full filename.

---

<div class="post-metadata">

**Author:** ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)\
**Post date:** [April 25, 2021, 7:47pm UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/5 "2021-04-25T19:47:20Z")

</div>

Excuse me, I am using google translator, now I re-read what I myself wrote, the wrong question on my part. I need to get tags from filenames, I'm good when there is no nested structure. When there are folders CD1 and CD2, then problems arise, especially when one folder is swept through a dash CD1 - bls bla bla

---

<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, 2021, 7:51pm UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/6 "2021-04-25T19:51:41Z")

</div>

To import data from a source with different patterns you need one pattern each.  
You can filter for files that have "CD" in the path with e.g.  
`%_path% MATCHES CD\d+`  
or for all those that do not have "CD" in the path:  
`NOT %_path% MATCHES CD\d+`  
Like that you can import the data with "CD" in the path with a dedicated pattern.

---

<div class="post-metadata">

**Author:** ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)\
**Post date:** [April 26, 2021, 9:18am UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/7 "2021-04-26T09:18:06Z")

</div>

Forgive my wildness, I did not understand exactly how to apply this in the program. Do you suggest first sorting by nesting, and then renaming the groups with different scripts?

---

<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 26, 2021, 9:29am UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/8 "2021-04-26T09:29:13Z")

</div>

> [@Mrakobes666](#):
>
> and then renaming the groups with different scripts

Yes (I think).  
First filter for files that have CD in the filename  
`%_path% MATCHES CD\d+`  
and import the data with a mask like  
`%artist%\%year% - %album%\CD%discnumber% - %discsubtitle%\%dummy%`

then filter for files that do not have CD in the filename  
`NOT %_path% MATCHES CD\d+`  
and import the data with a mask like  
`%artist%\%year% - %album%\%discsubtitle%\%dummy%`

You cannot have 1 mask for 2 different patterns.

---

<div class="post-metadata">

**Author:** ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)\
**Post date:** [April 27, 2021, 11:16am UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/9 "2021-04-27T11:16:21Z")

</div>

> [@ohrenkino](#):
>
> %\_path% MATCHES CD\d+

Tell me how to set up sorting - this option does not work

[![](https://community.mp3tag.de/uploads/default/original/2X/b/bccb2afe9ee05aeb0821b9f4fafca1fae70a8611.jpeg)](https://i114.fastpic.ru/big/2021/0427/ff/69b209b1856ee614709a2234e002fcff.png)

---

<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 27, 2021, 11:50am UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/10 "2021-04-27T11:50:47Z")

</div>

It's not sorting, it's _ **filtering** _.  
Press F3 to see where you can enter the filter.

---

<div class="post-metadata">

**Author:** ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)\
**Post date:** [April 27, 2021, 11:57am UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/11 "2021-04-27T11:57:54Z")

</div>

> [@ohrenkino](#):
>
> filtering

Yes, it happened. And can this %\_path% MATCHES CD\d+ be added to the sorting or saved somehow, so as not to re-enter the data in the filter string?

---

<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 27, 2021, 12:02pm UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/12 "2021-04-27T12:02:07Z")

</div>

As the filter reduces the number of displayed files it does not make sense to enter this string in a column definition. So the answer is: no, it cannot be added to sorting (as it is filtering).  
Filter expressions are saved automatically in the history for filters and can be accessed with the dropdown list for filters.

---

<div class="post-metadata">

**Author:** ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)\
**Post date:** [April 27, 2021, 12:20pm UTC](https://community.mp3tag.de/t/help-with-the-renaming-template/52965/13 "2021-04-27T12:20:34Z")

</div>

Thank you for your help, I will use your method

---

<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/help-with-the-renaming-template/52965/14 "2026-02-09T12:29:12Z")

</div>


