# Rename Folders with MP3 or FLAC indicator

**URL:** https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422
**Category:** Support
**Created:** [January 10, 2011, 5:45pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422 "2011-01-10T17:45:07Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![richmail](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b2d939/32.png) [@richmail](https://community.mp3tag.de/u/richmail)
#### Post date: [January 10, 2011, 5:45pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/1 "2011-01-10T17:45:07Z")

</div>

I want to rename Folder/Directory in the format

ABC-1990-Absolutely [FLac] [17] [Y]

%albumartist% - [%year% -]%album% %extension% %\_total\_files% %filetype% %\_covers% %\_filename\_ext%

I dont know whether i need filename\_ext or filetype to indicate MP3 or FLAC.

I also tried '[]' to get items in square brackets without sucess.

How can i make covers a yes or no rather than a number?

What does %\_counter% do?

Thanks for any assistance.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [January 10, 2011, 6:27pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/2 "2011-01-10T18:27:35Z")

</div>

> [@richmail](#):
>
> ...I want to rename Folder/Directory in the format  
> ABC-1990-Absolutely [FLac] [17] [Y]  
> ...

1. Read the Mp3tag Help Manual.

2. Use this Testfile:  
[richmail.mp3](https://community.mp3tag.de/uploads/default/original/2X/a/acf0a209cb6d07e687fed93458d3819f3b7a9fd9.mp3) (2.08 KB)

3. Try the following example, which changes the filename, to understand the principle.

 

**Convert** | **Tag - Filename** | **ALT+1**

 

_Select format string_

 

Format string:

 **%ALBUMARTIST%'-'%YEAR%'-'%ALBUM%' ['%\_extension%'] ['%TOTALTRACKS%'] '$ifgreater(%\_covers%,0,'[Y]','[N]')** 

Preview  
**ABC-1990-Absolutely [mp3] [17] [N].mp3**

 

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

1. Then try again to change the Foldername.

 

**Convert** | **Tag - Filename** | **ALT+1**

 

_Select format string_

 

Format string:  
**'..'%albumartist%'-'%year%'-'%album%' ['%\_extension%'] ['%totaltracks%'] '$ifgreater(%\_covers%,0,'[Y]','[N]')''%\_filename%**

 

Preview  
**..\ABC-1990-Absolutely [mp3] [17] [N]\richmail.mp3**

 

Example:  
"O:\TEST\T1\richmail.mp3" -\>  
"O:\TEST\ABC-1990-Absolutely [mp3] [17] [N]\richmail.mp3"

DD.20110110.2033.CET

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

[richmail.mp3](https://community.mp3tag.de/uploads/default/original/2X/a/acf0a209cb6d07e687fed93458d3819f3b7a9fd9.mp3) (2.08 KB)

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [January 10, 2011, 6:29pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/3 "2011-01-10T18:29:05Z")

</div>

> [@richmail](#):
>
> I want to rename Folder/Directory in the format
> 
> ABC-1990-Absolutely [FLac] [17] [Y]

Action: Format Value  
Field: \_DIRECTORY  
Formatstring:  
%albumartist%-%year%-%album% '['%\_extension%']' '['%\_total\_files%']' '['$if($grtr(%\_covers%,0),Y,N)']'

or

%albumartist%-%year%-%album% '['%\_extension%']' '['%\_total%']' '['$if($grtr(%\_covers%,0),Y,N)']'

the first formatstring gets you the number of total files from the number of files you have selected. the second gets it from the tracknumber if it is stored in the format tracknumber/totaltracks e.g. 1/17 , 2/17 ,...

> [@richmail](#):
>
> I dont know whether i need filename\_ext or filetype to indicate MP3 or FLAC.
> 
> I also tried '' to get items in square brackets without sucess.
> 
> How can i make covers a yes or no rather than a number?
> 
> What does %\_counter% do?
> 
> Thanks for any assistance.

it's %\_extension%

its '['...']'

$if($grtr(%\_covers%,0),Y,N) gives you Y for one or more covers and N for no cover.

%\_counter% gives every file a new number at the same field if you format more files. It's useless if you format the directory because in this special case it's always the first file from which the values are taken, so the counter would always be 1 (unless you format more than one folder ins one go). It can be usefull if you want the titles to be called simply track 1, track 2, track 3, you would use "track %\_counter%" in this case.

here is a oversight of the placeholders:  
[https://docs.mp3tag.de/format](https://docs.mp3tag.de/format)

---

<div class="post-metadata">

### Author: ![richmail](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b2d939/32.png) [@richmail](https://community.mp3tag.de/u/richmail)
#### Post date: [January 10, 2011, 8:59pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/4 "2011-01-10T20:59:24Z")

</div>

Pone and DevlevD

Thank you both very much.

I am going blind and with the date shown if varible, i missed the second ' . Anyhow your examples were excellent.

The clarification of %\_extension% and the difference between total and totaltracks was great. This sort of stuff should be explained in the user guides. You saved me another 4 hours of searching and eye killing strain.

Anyhow my new folder specification is

%albumartist% - [%year% -]%album% '['$upper(%\_extension%)']' '['%\_total\_files%']'['['%\_total%']'] '['$if($grtr(%\_covers%,0),Y,N)']'

ABC - Absolutely [FLAC] [17][17] [Y]

And i never needed the counter here at all.

Thanks again ![:rolleyes:](https://community.mp3tag.de/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif ":rolleyes:") ![:rolleyes:](https://community.mp3tag.de/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif ":rolleyes:")

---

<div class="post-metadata">

### Author: ![usavaci](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/7feea3/32.png) [@usavaci](https://community.mp3tag.de/u/usavaci)
#### Post date: [January 31, 2021, 9:50am UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/5 "2021-01-31T09:50:59Z")

</div>

Hi everyone I am trying to do the same thing by using these instructions but I can only changed the file names not the folder names. what could be wrong?

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [January 31, 2021, 11:10am UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/6 "2021-01-31T11:10:14Z")

</div>

> [@usavaci](#):
>
> I am trying to do the same thing

What do you exactly do?  
Do you use an action of the type "Format Value" for \_DIRECTORY or do you use the converter TAG-\>Filename?

---

<div class="post-metadata">

### Author: ![usavaci](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/7feea3/32.png) [@usavaci](https://community.mp3tag.de/u/usavaci)
#### Post date: [January 31, 2021, 1:58pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/7 "2021-01-31T13:58:07Z")

</div>

Well for the beginning I managed to do the add FLAC or MP3 to the folder name by using the code below in the action section.  
%ARTIST%'-'%YEAR%'-'%ALBUM% '('$upper(%\_extension%)')'

but what I want to add is;  
1-if there is no %albumartist% use %artist% tag  
2- Rename the folder if files are only MP3  
3-adding bit depth and sampling frequency to the flac album folder name such as "Opeth-2004-Damnation [16-44] " instead of adding (FLAC) to file name.

by the way is there any guide or detailed help file with all possible statements and actions with explanations. Especially I want to learn how to use if statement.

---

<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: [January 31, 2021, 2:49pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/8 "2021-01-31T14:49:40Z")

</div>

> [@usavaci](#):
>
> Especially I want to learn how to use if statement.

You will find all the script commands here:

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/#boolean-functions)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

There are several IF commands and some other boolean functions.

---

<div class="post-metadata">

### Author: ![usavaci](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/7feea3/32.png) [@usavaci](https://community.mp3tag.de/u/usavaci)
#### Post date: [January 31, 2021, 4:56pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/9 "2021-01-31T16:56:09Z")

</div>

Thank you, for the beginning it would be great if anyone help me to solve above problem. I can learn quite a lot from analyzing the above code.

---

<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: [January 31, 2021, 8:00pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/10 "2021-01-31T20:00:36Z")

</div>

Which part of code exactly do you want to have explained?

---

<div class="post-metadata">

### Author: ![usavaci](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/7feea3/32.png) [@usavaci](https://community.mp3tag.de/u/usavaci)
#### Post date: [January 31, 2021, 8:42pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/11 "2021-01-31T20:42:13Z")

</div>

Dear LyricsLover, I want to learn how to do this section especially.

3-adding bit depth and sampling frequency to the flac album folder name such as "Opeth-2004-Damnation [16-44] " instead of adding (FLAC) to file name.

---

<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: [January 31, 2021, 9:51pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/12 "2021-01-31T21:51:54Z")

</div>

In a first step you need to find the placeholders for "bit depth" and "sampling frequency".  
If you look here:

> **[Rename Files – Mp3tag Documentation](https://docs.mp3tag.de/converters/rename-files/)**
>
> Documentation on Tag to Filename, a converter to rename files based on tags. Mp3tag is the universal Tag Editor.

you will find possible matches with `%_bitrate%` and `%_samplerate%`  
Maybe you look for `%_bitspersample%`

> [@Bits per sample](https://community.mp3tag.de/t/bits-per-sample/14306/6):
>
> From the [Changelog](https://www.mp3tag.de/en/changelog.html): [2015-11-08] NEW: added information field %\_bitspersample% for some supported file types.

Please check, if this are the correct one.

With the matching placeholders you can build your action and replace the `'('$upper(%_extension%)')'` part with your new found placeholders.

You may find some additional hints in this existing thread:

> [@Rename If Extension](https://community.mp3tag.de/t/rename-if-extension/17710/6):
>
> See the FAQs for that: [/t/967/1](https://community.mp3tag.de/t/967/1) The 3rd example is how to append a string to a field. Instead of the example "xyz" use the field variable, probably %\_tag% and/or %\_bitspersample%. If you enclose the %\_bitspersample% in square brackets, [%\_bitspersample%] it gets treated like an "if" condition.

Please let us know, how your final format string looks like.

---

<div class="post-metadata">

### Author: ![usavaci](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/7feea3/32.png) [@usavaci](https://community.mp3tag.de/u/usavaci)
#### Post date: [February 2, 2021, 7:14am UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/13 "2021-02-02T07:14:48Z")

</div>

I reach my goal on the FLAC bits per sample and sample rate information. I am writing my experience as a tutorial for anyone need this type of Action.

First I tried the suggestions of @LyricsLover  
`%ARTIST%'-'%YEAR%'-'%ALBUM% '('$upper(%_extension%)')' '('%_samplerate%')'` :

> Ahkmed-2009-Distance (FLAC) (44100)

`%ARTIST%'-'%YEAR%'-'%ALBUM% '('$upper(%_extension%)')' '('%_bitrate%')' :`

> Ahkmed-2009-Distance (FLAC) ( 836)

`%ARTIST%'-'%YEAR%'-'%ALBUM% '('$upper(%_extension%)')' '('%_bitspersample%')'`

> Ahkmed-2009-Distance (FLAC) (16)

SUCCESS for the bits per sample 🙂

As you can see in the above sample rate case it will write the long value of the sample rate as "44100" but what I want to write is "44". In the forum I have this code to obtain my purpose

```
$cutRight(%_samplerate%,3)$trimRight('.'$right(%_samplerate%,3),'.0')' kHz'

48000 ==> 48 kHz
44100 ==> 44.1 kHz
22050 ==> 22.05 kHz
12000 ==> 12 kHz

```

I used this value

`%ARTIST%'-'%YEAR%'-'%ALBUM% '('$upper(%_extension%)')' '('%_bitspersample%'-'$cutRight(%_samplerate%,3)$trimRight('.'$right(%_samplerate%,3),'.0')' kHz'')'`

then I get

> Ahkmed-2009-Distance (FLAC) (16-44.1 kHz)

What I want to do is now delete the kHz section as given below

`%ARTIST%'-'%YEAR%'-'%ALBUM% '('$upper(%_extension%)')' '('%_bitspersample%'-'$cutRight(%_samplerate%,3)$trimRight('.'$right(%_samplerate%,3),'.0')')'`

> Ahkmed-2009-Distance (FLAC) (16-44.1)

Maybe I need to modify the code to write just 44 instead of 44.1 for the sample rate.

`%ARTIST%'-'%YEAR%'-'%ALBUM% '('$upper(%_extension%)')' '('%_bitspersample%'-'$cutRight(%_samplerate%,3)')'`

> Ahkmed-2009-Distance (FLAC) (16-44)

👍 👍 😁

---

<div class="post-metadata">

### Author: ![usavaci](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/7feea3/32.png) [@usavaci](https://community.mp3tag.de/u/usavaci)
#### Post date: [February 2, 2021, 8:32am UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/14 "2021-02-02T08:32:16Z")

</div>

I can continue to second part of my question after solving this one. What I want to do is adding (MP3) to the folder name. In the above code %\_extension% will add flac or mp3 to the folder name. But what I want to do is

-add extension to the folder name if files are MP3. For this I should definitely use "if" statement and for that definitely I need some help.

I have found this but I could not make it work  
`$if($eql(%_extension%,'Mp3'),,"("$upper(%_extension%)")")`

---

<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: [February 2, 2021, 8:50am UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/15 "2021-02-02T08:50:33Z")

</div>

> [@usavaci](#):
>
> I have found this but I could not make it work  
> `$if($eql(%_extension%,'Mp3'),,"("$upper(%_extension%)")")`

You can test your expressions in Convert\>Tag-Tag where the preview shows you the probably result.  
Please note that the functions are case sensitive.  
Right now your expression has a statement only for the FALSE case.

---

<div class="post-metadata">

### Author: ![usavaci](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/7feea3/32.png) [@usavaci](https://community.mp3tag.de/u/usavaci)
#### Post date: [February 2, 2021, 6:58pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/16 "2021-02-02T18:58:45Z")

</div>

Thank you. I correct the code but now I am having a bigger issue about the hidden files.

Due to the Macos operating system in the folders I have 4 kb hidden files named .\_SOMETHING  
 ![image](https://community.mp3tag.de/uploads/default/original/2X/e/e41be7a58fd0261db74f86ac2475344dadeb32bd.png)

because of these files folder naming fails because mp3tag reads these files as flac file with empty tag fields therefore folder names become

> -- (FLAC) [-]

Is there any way to avoid these files for an action ? Maybe an if condition can be used to limit file size higher than 10 kb but I have no idea to use multiple if conditions in one action.

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [February 3, 2021, 8:49am UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/17 "2021-02-03T08:49:25Z")

</div>

> [@usavaci](#):
>
> Is there any way to avoid these files for an action ? Maybe an if condition can be used to limit file size higher than 10 kb but I have no idea to use multiple if conditions in one action.

Why don't you just define a filter prior to use the action, i.e.  
`%_file_size_kb% GREATER 10`

---

<div class="post-metadata">

### Author: ![usavaci](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/7feea3/32.png) [@usavaci](https://community.mp3tag.de/u/usavaci)
#### Post date: [February 3, 2021, 10:10am UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/18 "2021-02-03T10:10:26Z")

</div>

Where should I add this code ?, I am new to actions. like this one ?

**%\_file\_size\_kb% GREATER 10** %ARTIST%'-'%YEAR%'-'%ALBUM% $if($eql(%\_extension%,'FLAC'),"("$upper(%\_extension%)")" '['%\_bitspersample%'-'$cutRight(%\_samplerate%,3)']','('$upper(%\_extension%)')')

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [February 3, 2021, 10:22am UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/19 "2021-02-03T10:22:53Z")

</div>

> [@usavaci](#):
>
> Where should I add this code ?

I was not talking of integrating my example into the action but simply use the filter box, which if you don't see it can if shown with F3.

---

<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:22pm UTC](https://community.mp3tag.de/t/rename-folders-with-mp3-or-flac-indicator/11422/20 "2026-02-09T12:22:49Z")

</div>


