# Rename folder

**URL:** https://community.mp3tag.de/t/rename-folder/6492
**Category:** Support
**Created:** [March 21, 2008, 1:43am UTC](https://community.mp3tag.de/t/rename-folder/6492 "2008-03-21T01:43:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![eojohans](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/ea666f/32.png) [@eojohans](https://community.mp3tag.de/u/eojohans)
#### Post date: [March 21, 2008, 1:43am UTC](https://community.mp3tag.de/t/rename-folder/6492/1 "2008-03-21T01:43:12Z")

</div>

I want to rename folders based on tags.

Example:  
Artist: The Beatles  
Album: Abbey Road  
Year: 1969

I want to rename the folder to "Beatles, The - [1969] Abbey Road"

Based on this thread: [Regular Expressions](https://community.mp3tag.de/t/521/15) I thought I had it, but the result is: Beatles - [1969] Abbey Road (Missing ", The")

I've created an action that looks like this:  
Format Value "\_DIRECTORY": $regexp(%artist%,^The (.+),$1, The) - '['%year%']' %album%

Obviously, if the artist name is missing the "The", the result should be Artist - [Year] Album

So, what am I missing? ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")

Cheers!

---

<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: [March 21, 2008, 6:35pm UTC](https://community.mp3tag.de/t/rename-folder/6492/2 "2008-03-21T18:35:47Z")

</div>

Inside a scripting function, a comma must be escaped:  
$regexp(%artist%,^The (.+),$1',' The) - '['%year%']' %album%

---

<div class="post-metadata">

### Author: ![eojohans](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/ea666f/32.png) [@eojohans](https://community.mp3tag.de/u/eojohans)
#### Post date: [March 21, 2008, 10:58pm UTC](https://community.mp3tag.de/t/rename-folder/6492/3 "2008-03-21T22:58:24Z")

</div>

Thanks dano, problem solved!

---

<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:20pm UTC](https://community.mp3tag.de/t/rename-folder/6492/4 "2026-02-09T12:20:51Z")

</div>


