# Tag -\> File rename

**URL:** https://community.mp3tag.de/t/tag-file-rename/15683
**Category:** Support
**Created:** [April 26, 2014, 9:14am UTC](https://community.mp3tag.de/t/tag-file-rename/15683 "2014-04-26T09:14:58Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 26, 2014, 9:14am UTC](https://community.mp3tag.de/t/tag-file-rename/15683/1 "2014-04-26T09:14:58Z")

</div>

Hi everybody ![:rolleyes:](https://community.mp3tag.de/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif ":rolleyes:")  
I'm new on the forum and this is my first post.  
I just discovered the fantastic Beatport script by Stevehero (thanks to him!) that make me saving a lot of time.  
Now, I would like to use the Tag -\> File rename function to save more time than ever.

I've found how to rename my mp3s like this: 01-Artist Name-Track Name.mp3

But I would like to rename like that: 01-artist\_name-track\_name\_[publisher\_name].mp3

Is it possible EXACTLY like that? I really want all tiny characters and the label (publisher) at the end of each file between []

Another question: is it possible to ask mp3tag to rename my playlist.m3u the same name than the parent folder, and if possible, also with all tiny characters?

Example: 00-artist\_name-album\_name-(catalog\_number).m3u

Thanks a lot for you help!

---

<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: [April 26, 2014, 10:27am UTC](https://community.mp3tag.de/t/tag-file-rename/15683/2 "2014-04-26T10:27:41Z")

</div>

> [@sharpouze](#):
>
> But I would like to rename like that: 01-artist\_name-track\_name\_[publisher\_name].mp3

Format String:  
$num(%track%,2)-$lower(%artist%-%title%-'['%publisher%']')

> [@](#):
>
> Another question: is it possible to ask mp3tag to rename my playlist.m3u the same name than the parent folder, and if possible, also with all tiny characters?
> 
> Example: 00-artist\_name-album\_name-(catalog\_number).m3u

To rename your playlist you have to use the wanted placeholders in Tools/Options/Playlist/Filename of playlist. I don't know in which way in your example the parent directory in represented.  
Using the parent directory you would have to fill in  
$lower(%\_parent\_directory%).m3u

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 26, 2014, 9:44pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/3 "2014-04-26T21:44:01Z")

</div>

Excellent !!! ![:w00t:](https://community.mp3tag.de/uploads/default/original/1X/cb01eca72fe9339ff6f3ec9f1e3c5fe002be0f0a.gif ":w00t:")  
Thank you very much for your rapid answer, will try this NOW 😆  
See Ya!

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 27, 2014, 4:11pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/4 "2014-04-27T16:11:43Z")

</div>

Thank you for the format string but I just need a little adjustment.  
Indeed, for the moment it goes like that : 01-artist name-track name-[publisher name]

I would like that result instead : 01-artist\_name-track\_name\_[publisher\_name].mp3

So the changes are about a \_ between each word instread of a space, and another \_ before the [publisher\_name].

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

---

<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: [April 27, 2014, 4:40pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/5 "2014-04-27T16:40:23Z")

</div>

> [@sharpouze](#):
>
> how to rename my mp3s like this:  
> 01-Artist Name-Track Name.mp3  
> But I would like to rename like that:  
> 01-artist\_name-track\_name\_[publisher\_name].mp3

... to do ...

- format track number as 2-digit number
- enclose data from the tag-field PUBLISHER into square brackets,  
... protect against non existing publisher,  
... add it as last part to the filename
- replace each space character with one underline character
- convert all characters into lower casing

**Action "Format value" or Convert "Tag - Tag" Field ......: \_FILENAME Formatstring: $lower($replace($num(%TRACK%,2)'-'%ARTIST%'-'%TITLE%[' ['%PUBLISHER%']'],' ','\_'))**

DD.20140427.2051.CEST

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 27, 2014, 5:04pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/6 "2014-04-27T17:04:12Z")

</div>

Very interesting thanks.  
If I understand well, I have to put those 3 lines in the sript from stevehero ?

Action "Format value" or Convert "Tag - Tag"  
Field ......: _FILENAME  
Formatstring: $lower($replace($num(%TRACK%,2)'-'%ARTIST%'-'%TITLE%[' ['%PUBLISHER%']'],' ','_'))

And If i'm good, where exactly ?

---

<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: [April 27, 2014, 5:07pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/7 "2014-04-27T17:07:44Z")

</div>

> [@sharpouze](#):
>
> Very interesting thanks.  
> If I understand well, I have to put those 3 lines in the sript from stevehero ?

No.

DD.20140427.2107.CEST

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 27, 2014, 5:18pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/8 "2014-04-27T17:18:31Z")

</div>

Sorry for my misunderstanding so ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")  
I just pasted the formatstring onto the Tag -\> Filename and it's just perfect !

But, maybe you gave me that 3 lines to make Mp3Tag auto rename my selected mp3s without having to go to Tag -\> Filename right ?

I'm feeling like a noob, even if i'm using mp3tag for more than 3 years lol It's just that I had never discovered the advanced functions of that powerfull software.

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

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 27, 2014, 5:22pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/9 "2014-04-27T17:22:58Z")

</div>

I've Found the Action Option, that's OK 😆

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 27, 2014, 5:50pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/10 "2014-04-27T17:50:48Z")

</div>

> [@poster](#):
>
> Format String:  
> $num(%track%,2)-$lower(%artist%-%title%-'['%publisher%']')
> 
> To rename your playlist you have to use the wanted placeholders in Tools/Options/Playlist/Filename of playlist. I don't know in which way in your example the parent directory in represented.  
> Using the parent directory you would have to fill in  
> $lower(%\_parent\_directory%).m3u

I have a question about that format string.  
Indeed, If my directory is :

/0401/Artist\_Name-Album\_Name-(CATALOG)-WEB-2014/

my playlist will be : 0401.m3u

and not : artist\_name-album\_name-(catalog)-web-2014.m3u

Any Idea ?

---

<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: [April 27, 2014, 6:06pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/11 "2014-04-27T18:06:59Z")

</div>

> [@sharpouze](#):
>
> I have a question about that format string.  
> Indeed, If my directory is :
> 
> /0401/Artist\_Name-Album\_Name-(CATALOG)-WEB-2014/
> 
> my playlist will be : 0401.m3u
> 
> and not : artist\_name-album\_name-(catalog)-web-2014.m3u
> 
> Any Idea ?

If you use the full path as filename, then this illegal. You could use the function $validate() to get rid of the illegal characters in the filename.

---

<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: [April 27, 2014, 6:35pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/12 "2014-04-27T18:35:17Z")

</div>

> [@sharpouze](#):
>
> I have a question about that format string.  
> Indeed, If my directory is :
> 
> /0401/Artist\_Name-Album\_Name-(CATALOG)-WEB-2014/
> 
> my playlist will be : 0401.m3u
> 
> and not : artist\_name-album\_name-(catalog)-web-2014.m3u
> 
> Any Idea ?

You asked fpr the **parent** directory. But what you obviously are looking for is the directory and not the parent directory.  
$lower(%\_directory%).m3u

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 27, 2014, 7:19pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/13 "2014-04-27T19:19:17Z")

</div>

Oh yes, you're right !  
My english might not be perfect ![:huh:](https://community.mp3tag.de/uploads/default/original/1X/f15ee73c0fd9ec3b0db7481f0558638f8ee224ce.gif ":huh:")

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 27, 2014, 7:19pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/14 "2014-04-27T19:19:17Z")

</div>

Now I'm trying to create a new Action for the Directory.  
Indeed, I'm still creating the Dir manualy, what a lack of time 😳

I want this result as you already know : Artist\_Name-Album\_Name-(CATNUMBER)-WEB-2014

My album tag already contains the Cat Number like that : Album Name (CATNUMBER).

So I did : Action / Format Value / Field : \_DIRECTORY

The only format string I could create is : %artist%-%album%-WEB-2014

So that makes : Artist Name-Album Name (CATNUMBER)-WEB-2014

Even after trying to analyse your previous format string for the filename, I'm still not able to replace each space character with one underline character.  
And not able to replace the underline character before the (CATNUMBER) with a -

![<_<](https://community.mp3tag.de/uploads/default/original/1X/5996dbb474c88b8f9fc49f09dc3858d081055a2d.gif "<\_<")

---

<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: [April 28, 2014, 4:40am UTC](https://community.mp3tag.de/t/tag-file-rename/15683/15 "2014-04-28T04:40:45Z")

</div>

> [@sharpouze](#):
>
> Now I'm trying to create a new Action for the Directory. ...  
> I want this result ... Artist\_Name-Album\_Name-(CATNUMBER)-WEB-2014 ...

Be aware of, when working with the "pseudo tag-field" \_FILENAME or \_DIRECTORY, then you manipulate the file path name or folder path name of the one related media file.  
Be aware of, when renaming a folder path name, then at once all files in the original folder will be touched too.  
My advice is: Prepare such manipulations on the filesystem by using one or more temporary tag-fields.  
This way you have full control of the result without getting into chaos on your disk.

You can create a group of actions to work out and define each single step on your way to the final result.  
If the preview result is looking good, then and only then add the very last action step to set the "pseudo tag-field" \_FILENAME or \_DIRECTORY.

Be aware of, that the "pseudo tag-field" \_FILENAME or \_DIRECTORY can change the entire path name, starting from the location of media file up to the disk root.

For example ...

- Create a new action group with a name of your choice.

- Add action "Format value" to create a temporary tag-field ...  
Field: ARTIST\_NEW  
Formatstring: %ARTIST%

- Add action "Format value" to create a temporary tag-field ...  
Field: ALBUM\_NEW  
Formatstring: %ALBUM%  
... and so on for each tag-field, which you want to manipulate.

- Add action "Replace"  
Field: %ARTIST\_NEW%  
Original:   
Replace with: 

- Add action "Replace"  
Field: %ALBUM\_NEW%  
Original:   
Replace with:   
... and so on for each tag-field, which you want to manipulate.

Assemble the new values into one formatstring ...

- Add action "Format value"  
Field: FILENAME\_NEW  
Formatstring: %ARTIST\_NEW%'-'%ALBUM\_NEW%

If the content of the tag-field FILENAME\_NEW looks ok, then apply it to the file system ...

- Add action "Format value"  
Field: \_FILENAME  
Formatstring: %FILENAME\_NEW%

At last remove all temporary tag-fields ...

- Add action "Remove fields"  
Fields to remove: ARTIST\_NEW;ALBUM\_NEW;FILENAME\_NEW

Ready.

DD.20140428.0840.CEST

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 28, 2014, 11:20am UTC](https://community.mp3tag.de/t/tag-file-rename/15683/16 "2014-04-28T11:20:49Z")

</div>

Thank You for your detailed explanations, they are very instructive.  
I try to understand all the components of your tutorial but It's not so easy for me, as you can imagine...  
I'm near from my goal anyway, but i'm still not able to have the result I want for the Directory.

The best I can have is : Artist Name-Album Name (CATNUBER)-WEB-2014

Still not able to replace the spaces with underlines and the space before (CATNUMBER) with a -

😳

---

<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: [April 28, 2014, 1:17pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/17 "2014-04-28T13:17:11Z")

</div>

> [@sharpouze](#):
>
> ... Still not able to replace the spaces with underlines and the space before (CATNUMBER) with a -

You already know the action "Replace" and you know the scripting function **$replace()**.  
The purpose of these helpers is to replace a given string by another given string.  
So you can replace the string **' ('** by the string **'-('**.  
So you can replace a space character **' '** by an underline character **'\_'**.

DD.20140428.1717.CEST

---

<div class="post-metadata">

### Author: ![sharpouze](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sharpouze](https://community.mp3tag.de/u/sharpouze)
#### Post date: [April 28, 2014, 10:39pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/18 "2014-04-28T22:39:31Z")

</div>

Yes I've found ![:w00t:](https://community.mp3tag.de/uploads/default/original/1X/cb01eca72fe9339ff6f3ec9f1e3c5fe002be0f0a.gif ":w00t:")

Thank you for all your help, I'll save a lot of time now 😆  
Hope to be helpful myself in the future !  
See Ya !

---

<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:25pm UTC](https://community.mp3tag.de/t/tag-file-rename/15683/19 "2026-02-09T12:25:00Z")

</div>


