# Adding file type or bit rate to Folder name (IF function)

**URL:** <https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483>\
**Category:** Support\
**Created:** [May 19, 2019, 8:50pm UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483 "2019-05-19T20:50:20Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![LikeLinus](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/bbe5ce/32.png) [@LikeLinus](https://community.mp3tag.de/u/LikeLinus)\
**Post date:** [May 19, 2019, 8:50pm UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/1 "2019-05-19T20:50:20Z")

</div>

Hi. I'm a new user to MP3Tag and I'm trying to figure out how to rename my folders a certain way. I've created an action with the default value of "\_DIRECTORY" and then trying to use a format string for the naming convention.

Basically what I want to do is have the folder name be "Year - Album [FLAC or Bitrate)

I want to do this so that if the file is FLAC, it obviously shows FLAC. But if it's an MP3, I want it to show the bitrate. So I'm assuming this is done using an IF function, but I can't get it right. I've played around with a bunch of variations (few below) but I keep getting errors and I'm obviously not a coder. 🙂

I based this off the $if(x,y,z) if x is true, y is returned, otherwise z

%year% - %album% $if(%\_extension%=flac,%\_extention,%\_bitrate%)

%year% - %album% $if(%\_extension%=flac,FLAC,%\_bitrate%)

%year% - %album% $if($eql(%\_extension% IS 'flac'),%\_extention,%bitrate%)

%year% - %album% $if($eql(%\_extension%, 'flac'),FLAC,%bitrate%)

I can get Year - Album [%\_extention] to work perfectly, but I'm lost of the IF statement and can't get it work. Is this even possible? Any advise would be greatly appreciated.

THANKS!!  
Linus

---

<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, 2019, 8:59pm UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/2 "2019-05-19T20:59:14Z")

</div>

THis is almost right

> [@LikeLinus](#):
>
> %year% - %album% $if($eql(%\_extension%, 'flac'),FLAC,%bitrate%)

Try  
`%year% - %album% $if($eql(%_extension%,flac),FLAC,%_bitrate%)`

---

<div class="post-metadata">

**Author:** ![LikeLinus](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/bbe5ce/32.png) [@LikeLinus](https://community.mp3tag.de/u/LikeLinus)\
**Post date:** [May 19, 2019, 9:03pm UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/3 "2019-05-19T21:03:37Z")

</div>

Wow, that was fast. THANK YOU so much!! And this is why I stick to graphics and not coding 😃

You're the man.

---

<div class="post-metadata">

**Author:** ![LikeLinus](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/bbe5ce/32.png) [@LikeLinus](https://community.mp3tag.de/u/LikeLinus)\
**Post date:** [May 19, 2019, 9:17pm UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/4 "2019-05-19T21:17:05Z")

</div>

Here is what I ended up with.

%year% - %album% $if($eql(%\_extension%,flac),'(FLAC)','('%\_bitrate%'kbps)')

Example of what you the outcome is:

1994 - The Downward Spiral (FLAC)  
or  
1994 - The Downward Spiral (320kbps)

---

<div class="post-metadata">

**Author:** ![djeurotraxx](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@djeurotraxx](https://community.mp3tag.de/u/djeurotraxx)\
**Post date:** [November 3, 2022, 9:18am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/5 "2022-11-03T09:18:52Z")

</div>

How would you also incorporate WAV into this? So the output is either FLAC, WAV, or bitrate

---

<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:** [November 3, 2022, 9:28am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/6 "2022-11-03T09:28:59Z")

</div>

Try  
`$ifgreater($strstr(FLACWAV,$upper(%_extension%)),0,$upper(%_extension%),%_bitrate% kbps)`

---

<div class="post-metadata">

**Author:** ![djeurotraxx](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@djeurotraxx](https://community.mp3tag.de/u/djeurotraxx)\
**Post date:** [November 3, 2022, 9:49am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/7 "2022-11-03T09:49:02Z")

</div>

That works, but missing the [], so it comes out as WAV instead of [WAV] etc

---

<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:** [November 3, 2022, 9:56am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/8 "2022-11-03T09:56:19Z")

</div>

It says nowehre in the thread that the square brackets are needed.  
And if you need them, Use '[' and ']' to insert them, where you like them.

---

<div class="post-metadata">

**Author:** ![djeurotraxx](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@djeurotraxx](https://community.mp3tag.de/u/djeurotraxx)\
**Post date:** [November 3, 2022, 9:56am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/9 "2022-11-03T09:56:28Z")

</div>

Think i got it  
$ifgreater($strstr(FLACWAV,$upper(%\_extension%)),0,$upper'[%\_extension%]','['%\_bitrate%'kbps]')

Thank you!

---

<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:** [November 3, 2022, 9:59am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/10 "2022-11-03T09:59:12Z")

</div>

> [@djeurotraxx](#):
>
> $ifgreater($strstr(FLACWAV,$upper(%\_extension%)),0,$upper'[%\_extension%]','['%\_bitrate%'kbps]')

This would be shorter:  
`'['$ifgreater($strstr(FLACWAV,$upper(%_extension%)),0,$upper(%_extension%),%_bitrate% kbps)']'`

---

<div class="post-metadata">

**Author:** ![djeurotraxx](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@djeurotraxx](https://community.mp3tag.de/u/djeurotraxx)\
**Post date:** [November 3, 2022, 10:04am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/11 "2022-11-03T10:04:26Z")

</div>

That works also!  
I image adding a VBR variable to bitrate would be a stretch? 🙃

---

<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:** [November 3, 2022, 10:08am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/12 "2022-11-03T10:08:34Z")

</div>

You can add whatever information you want, like `%_VBR%`:

> **[Format Strings and Placeholders – Mp3tag Documentation](https://docs.mp3tag.de/format/#technical-information)**
>
> Documentation on format strings and placeholders to describe the structure of file names and imported data. Mp3tag is the universal Tag Editor.

---

<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:** [November 3, 2022, 10:11am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/13 "2022-11-03T10:11:15Z")

</div>

If the bitrate is variable ... it varies from file to file. So which value would you like to see?

---

<div class="post-metadata">

**Author:** ![djeurotraxx](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@djeurotraxx](https://community.mp3tag.de/u/djeurotraxx)\
**Post date:** [November 3, 2022, 10:13am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/14 "2022-11-03T10:13:47Z")

</div>

So for CBR the actual [bitrate], for variable i'd like to see just [VBR] instead of the actual

---

<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:** [November 3, 2022, 10:23am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/15 "2022-11-03T10:23:29Z")

</div>

Before I invest any more brainpower, please note that MP3tag looks at every file individually and then renames the folder.  
So if you have a mixture of VBR and CBR files, you will see only one of the properties in the folder name (depending which file won).  
So, I doubt that this information is really beneficial.  
And why not make it easier and simply add the property %\_VBR% to the bitrate output so that you know how to interpret that data.

---

<div class="post-metadata">

**Author:** ![djeurotraxx](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@djeurotraxx](https://community.mp3tag.de/u/djeurotraxx)\
**Post date:** [November 3, 2022, 10:40am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/16 "2022-11-03T10:40:05Z")

</div>

> [@ohrenkino](#):
>
> %\_VBR%

No mixtures. My folders are same CBR bitrate, or VBR - V0, V1 etc, I was not talking about having a mixture of different bitrate files in same folder. Sorry for confusion.  
And no worries, I appreciate your efforts!

---

<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:** [December 3, 2022, 10:40am UTC](https://community.mp3tag.de/t/adding-file-type-or-bit-rate-to-folder-name-if-function/45483/17 "2022-12-03T10:40:53Z")

</div>

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