# Help to create a parameter to rename folders

**URL:** https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805
**Category:** Support
**Created:** [September 12, 2010, 9:05pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805 "2010-09-12T21:05:31Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Tisogro](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Tisogro](https://community.mp3tag.de/u/Tisogro)
#### Post date: [September 12, 2010, 9:05pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805/1 "2010-09-12T21:05:31Z")

</div>

So, I searched a bit in forums and was using the following parameter:

Format Value  
Field: \_DIRECTORY  
Formatstring: %album% '['$if($eql(%\_vbr%,'VBR'),VBR %\_bitrate%,%\_bitrate%),$replace(%\_samplerate%,44100,44,48000,48)']'

This parameter rename my folder to the following format:  
C:\XXXXXX\Music\<Album Name\> \<[bitrate,edited sample rate]\>\

What I want: a parameter that can put the year too and create sub-folders with the numbers of CDs (just if they exist in tags), and also always remove the last 3 digits of the "sample rate", becoming something like this:

C:\XXXXXX\Music\<year\> - \<[bitrate,sample rate without last 3 digits]\>\CD 1

Ex's:  
C:\XXXXXX\Music\2010 - Extreme Album [320,48]\CD 1  
C:\XXXXXX\Music\2010 - Extreme Album [320,48]\CD 2  
C:\XXXXXX\Music\2009 - Ultra Album [320,44]  
C:\XXXXXX\Music\Super Album [128,22]\

It's possible to do that? I think there's a smarter way to do this than manually...

Thanks in advantage! 😆 And please, don't mind my poor english.... ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")

---

<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: [September 14, 2010, 4:20pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805/2 "2010-09-14T16:20:53Z")

</div>

What if you included the backslash in the formatting action  
$if($geql(%discnumber%,1),'\CD %discumber%','')

---

<div class="post-metadata">

### Author: ![Tisogro](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Tisogro](https://community.mp3tag.de/u/Tisogro)
#### Post date: [September 18, 2010, 1:35pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805/3 "2010-09-18T13:35:30Z")

</div>

No, i just get a sub folder called "CD %discnumber%" ☹

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [September 18, 2010, 2:41pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805/4 "2010-09-18T14:41:24Z")

</div>

With \_DIRECTORY you can rename the current folder but not create a new one.

Use \_FILENAME to create a new folder.

Format Value  
Field: \_FILENAME  
Format string: %\_folderpath%$if($geql(%discnumber%,1),CD $num(%discnumber%,1),)%\_filename%

(It's important that your one disc albums have no discnumber tag)

---

<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: [September 18, 2010, 2:50pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805/5 "2010-09-18T14:50:20Z")

</div>

> [@Tisogro](#):
>
> ... remove the last 3 digits of the "sample rate" ...

There are several ways to do this with Mp3tag Scripting Language.

Convert the value of \_SAMPLERATE ...  
From:  
44100  
To:  
44

**$mid(%\_samplerate%,1,$sub($len(%\_samplerate%),3))****$left(%\_samplerate%,$sub($len(%\_samplerate%),3))****$replace(%\_samplerate%'$',$right(%\_samplerate%'$',4),%DUMMY%)****$regexp(%\_samplerate%,'^(.+?)...$','$1')****$replace(%\_samplerate%,'32000','32','44100','44','48000','48','96000','96','192000','192')****$div(%\_samplerate%,1000)**

DD.20100918.1932.CEST

---

<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: [September 18, 2010, 3:29pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805/6 "2010-09-18T15:29:18Z")

</div>

> [@Tisogro](#):
>
> ... create sub-folders with the numbers of CDs (just if they exist in tags) ...

There are several forum threads about DISCNUMBER and subfolders and so on.  
[Generating %DISCNUMBER% Tags](https://community.mp3tag.de/t/4117/1)  
[Discnumber Action](https://community.mp3tag.de/t/5793/1)  
[Settgin disc qty from folder qty](https://community.mp3tag.de/t/6567/1)  
[Automatic Discnumber tag from Directory Structure](https://community.mp3tag.de/t/10395/1)

DD.20100918.1930.CEST

---

<div class="post-metadata">

### Author: ![Tisogro](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Tisogro](https://community.mp3tag.de/u/Tisogro)
#### Post date: [September 18, 2010, 6:23pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805/7 "2010-09-18T18:23:35Z")

</div>

> [@dano](#):
>
> With \_DIRECTORY you can rename the current folder but not create a new one.  
> Use \_FILENAME to create a new folder.  
> (...)

> [@DetlevD](#):
>
> There are several ways to do this with Mp3tag Scripting Language.  
> (...)  
> $replace(%\_SAMPLERATE%$,$right(%\_SAMPLERATE%$,4),)  
> (...)

These have worked for me. Thanks! 😆

---

<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: [September 18, 2010, 6:39pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805/8 "2010-09-18T18:39:02Z")

</div>

> [@Tisogro](#):
>
> These have worked for me. Thanks! 😆

Just because of curiosity ...  
... why did you choose this expression ...  
$replace(%\_SAMPLERATE%'$',$right(%\_SAMPLERATE%'$',4),)

... instead of the simple and effective ...  
$div(%\_SAMPLERATE%,1000)  
???

DD.20100918.2239.CEST

---

<div class="post-metadata">

### Author: ![Tisogro](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Tisogro](https://community.mp3tag.de/u/Tisogro)
#### Post date: [September 18, 2010, 7:36pm UTC](https://community.mp3tag.de/t/help-to-create-a-parameter-to-rename-folders/10805/9 "2010-09-18T19:36:47Z")

</div>

> [@DetlevD](#):
>
> Just because of curiosity ...  
> ... why did you choose this expression ...  
> $replace(%\_SAMPLERATE%'$',$right(%\_SAMPLERATE%'$',4),)
> 
> ... instead of the simple and effective ...  
> $div(%\_SAMPLERATE%,1000)  
> ???
> 
> DD.20100918.2239.CEST

I've just take one randomly... ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")

---

<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/help-to-create-a-parameter-to-rename-folders/10805/10 "2026-02-09T12:22:33Z")

</div>


