# Show your file rename format string

**URL:** https://community.mp3tag.de/t/show-your-file-rename-format-string/41758
**Category:** General Discussion
**Created:** [May 22, 2018, 5:52pm UTC](https://community.mp3tag.de/t/show-your-file-rename-format-string/41758 "2018-05-22T17:52:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![KarlM](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/d2c977/32.png) [@KarlM](https://community.mp3tag.de/u/KarlM)
#### Post date: [May 22, 2018, 5:52pm UTC](https://community.mp3tag.de/t/show-your-file-rename-format-string/41758/1 "2018-05-22T17:52:42Z")

</div>

`%albumartist% - (%year%) %album%$if(%discnumber%, - CD$left(%discnumber%,1),) - $num(%track%,2) - $if($stricmp(%artist%,%albumartist%),,%artist% - )%title%`

At least it is in my opinion. Took me several hours to end up with this. Wish there were examples like these of somewhat matured formulas that detect several common issues with tags and filenames to choose from. Still would need to add some $replace functions to catch those slashes and whatnot, but generally this is the formula I am using now for my library. Can't be bothered to refine it further.

Why isn't there a thread like this in which users post their formulas? Or maybe google just failed to index. Anyway, it is there now.

Currently using this one. It's way less restrictive as the first one I posted.  
%albumartist% - [(%year%)][%album% -][CD$left(%discnumber%,1) -][$num(%track%,2) -][$if($stricmp(%artist%,%albumartist%),,%artist% - )]%title%

---

<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 22, 2018, 6:02pm UTC](https://community.mp3tag.de/t/show-your-file-rename-format-string/41758/2 "2018-05-22T18:02:24Z")

</div>

did you know that you can reduce the part

> [@KarlM](#):
>
> `$if(%discnumber%, - CD$left(%discnumber%,1),)`

to [- $num(%discnumber%,1)]  
as the square brackets serve as some kind of if-statement.

Also,

> [@KarlM](#):
>
> $if($stricmp(%artist%,%albumartist%),,%artist% - )

could be shortened to  
$if2(%artist%,%albumartist%)

On the discnumber problem there is e.g. this thread:

> [@Add discnumber with separator only when Discnumber exists](https://community.mp3tag.de/t/add-discnumber-with-separator-only-when-discnumber-exists/14827):
>
> I have run into small issue, I want to use filename formatting as: %discnumber%-$num(%track%,2) - %artist% - %title% It works well untill I have MultiDisc compilation, but if DiscNumber filed is empyt (Single Disc), then it only adds separator. How to avoid that? Basically what I would want to accomplish, would be that separator - after %discnumber% gets only added when Discnumber field actually has something in it. [:rolleyes:]

On the artist or albumartist problem, there is e.g. this thread:

> [@Album-Interpret verwenden, wenn Interpreten unterschiedlich sind](https://community.mp3tag.de/t/album-interpret-verwenden-wenn-interpreten-unterschiedlich-sind/12556):
>
> Hallo zusammen, ich habe ein kleines Problem, aber ich fand leider trotz Recherche keine Lösung. Ich habe meine Musik schon getagged und möchte nun meine Ordnerstruktur wie folgt anlegen: Interpret/Album/Titel Das wäre ja wirklich kein Problem, allerdings habe ich bei den Interpreten sehr oft noch zusätzliche Interpreten mit drin. In diesem Fall soll der Album-Interpret verwendet werden. Leider habe ich auch viele Alben, wo ich der Album-Interpret leer ist, weil keine anderen Künstler vor kam…

---

<div class="post-metadata">

### Author: ![KarlM](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/d2c977/32.png) [@KarlM](https://community.mp3tag.de/u/KarlM)
#### Post date: [May 22, 2018, 6:09pm UTC](https://community.mp3tag.de/t/show-your-file-rename-format-string/41758/3 "2018-05-22T18:09:11Z")

</div>

Holly molly. What a great answer in that short amount of time.
