# How to rename filename

**URL:** <https://community.mp3tag.de/t/how-to-rename-filename/14098>\
**Category:** Support\
**Created:** [November 9, 2012, 9:27am UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098 "2012-11-09T09:27:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![stanray](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/85e7bf/32.png) [@stanray](https://community.mp3tag.de/u/stanray)\
**Post date:** [November 9, 2012, 9:27am UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/1 "2012-11-09T09:27:27Z")

</div>

Hello,  
I've used MP3tag with great success organising my whole music library. But now I run into a seemingly simple task which I can't perform, because I probably doing something wrong, but I don't know what ☹ .  
Most of my filenames are like this: "02 - ", but some are like: "02; " or: "02. ". Now how do I rename all my filenames to the first mentioned format?

Thanks  
Stanray

---

<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 9, 2012, 9:31am UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/2 "2012-11-09T09:31:31Z")

</div>

> [@stanray](#):
>
> Now how do I rename all my filenames to the first mentioned format?
> 
> Thanks  
> Stanray

Well, you could perform a "Replace action" for \_FILENAME. that replaces the offending character with the correct one.

Or you use the converter TAG-FILENAME and a mask like this:

$num(%track%,2) - %artist% - %title%

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [November 9, 2012, 10:04am UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/3 "2012-11-09T10:04:11Z")

</div>

> [@stanray](#):
>
> Most of my filenames are like this: "02 - ", but some are like: "02; " or: "02. ". Now how do I rename all my filenames to the first mentioned format?
> 
> Thanks  
> Stanray

You could run something like this:

Begin Action Group **\_Script Test#TEST**

**Action #1** _Actiontype 5:_ **Format value** _Field \_\_\_\_\_\_:_ **\_FILENAME** _Formatstring:_ **$regexp(%\_filename%,^\d+\s\*-\*\.\*;\*\s\*(.+),$num(%track%,2) - $1)**

End Action Group **\_Script Test#TEST** (1 Action)

Its gets all the text string after:  
'02 - '  
'02; '  
'02. '

And replaces it with TRACK padded with 2 numbers and then - $1 (What has been captured after the 3 things above.

---

<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:** [November 9, 2012, 10:44am UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/4 "2012-11-09T10:44:32Z")

</div>

> [@stanray](#):
>
> ... Most of my filenames are like this: "02 - ", but some are like: "02; " or: "02. ". Now how do I rename all my filenames to the first mentioned format? ...

This proposal does not need any tag-field value, but just the filename ...

 

**Convert** | **Tag - Tag** | **ALT+5**

 

_Select format string_

 

Field:  
**\_FILENAME**

 

Format string:

 **$regexp($regexp(%\_filename%,'^(\d+)[;.-]+(.+)$','00$1 - $2'),'0\*(\d\d)(.+)','$1$2')** 

... or ...

 **$regexp('00'%\_filename%,'^0\*(\d\d)[;.-]+(.+)$','$1 - $2')** 

Preview  
From:  
**01 - song one.mp3  
02; song two.mp3  
3. song three.mp3  
04 song four.mp3  
5 song five.mp3**

 

To:  
**01 - song one.mp3  
02 - song two.mp3  
03 - song three.mp3  
04 - song four.mp3  
05 - song five.mp3**

 

Testfiles ...  
[20121109.stanray.renumber.zip](https://community.mp3tag.de/uploads/default/original/2X/8/8ff2eef60e5768e77957f29aed491bfdf87e259d.zip) (1.77 KB)  
DD.20121109.1242.CET

[20121109.stanray.renumber.zip](https://community.mp3tag.de/uploads/default/original/2X/8/8ff2eef60e5768e77957f29aed491bfdf87e259d.zip) (1.77 KB)

---

<div class="post-metadata">

**Author:** ![stanray](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/85e7bf/32.png) [@stanray](https://community.mp3tag.de/u/stanray)\
**Post date:** [November 12, 2012, 7:48am UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/5 "2012-11-12T07:48:02Z")

</div>

Thank you so much all, very helpful.  
Problem solved!

Stanray

---

<div class="post-metadata">

**Author:** ![faisdlair](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/c4cdca/32.png) [@faisdlair](https://community.mp3tag.de/u/faisdlair)\
**Post date:** [March 21, 2016, 3:15pm UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/6 "2016-03-21T15:15:47Z")

</div>

> [@DetlevD](#):
>
> This proposal does not need any tag-field value, but just the filename ...
> 
>  
> 
> **Convert** | **Tag - Tag** | **ALT+5**
> 
>  
> 
> _Select format string_
> 
>  
> 
> Field:  
> **\_FILENAME**
> 
>  
> 
> Format string:
> 
> **$regexp($regexp(%\_filename%,'^(\d+)[;.-]+(.+)$','00$1 - $2'),'0\*(\d\d)(.+)','$1$2')** 
> 
> ... or ...
> 
> **$regexp('00'%\_filename%,'^0\*(\d\d)[;.-]+(.+)$','$1 - $2')** 
> 
> Preview  
> From:  
> **01 - song one.mp3  
> 02; song two.mp3  
> 3. song three.mp3**  
> To:  
> **01 - song one.mp3  
> 02 - song two.mp3  
> 03 - song three.mp3**
> 
>  
> 
> DD.20121109.1242.CET

Ok and what about

01 Hold on to Love  
To  
01 - Hold on to Love (don't work)

Thank you

---

<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:** [March 21, 2016, 5:29pm UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/7 "2016-03-21T17:29:11Z")

</div>

> [@faisdlair](#):
>
> Ok and what about  
> 01 Hold on to Love ...

Both formatstrings work as designed, try again.

DD.20160321.1929.CET

---

<div class="post-metadata">

**Author:** ![faisdlair](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/c4cdca/32.png) [@faisdlair](https://community.mp3tag.de/u/faisdlair)\
**Post date:** [March 21, 2016, 5:38pm UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/8 "2016-03-21T17:38:22Z")

</div>

I tried it with both formatstrings and it makes no change

 ![](https://community.mp3tag.de/uploads/default/original/2X/9/906835a44a68c6337f0036ce88978655d69d32e0.jpg)

---

<div class="post-metadata">

**Author:** ![faisdlair](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/c4cdca/32.png) [@faisdlair](https://community.mp3tag.de/u/faisdlair)\
**Post date:** [March 21, 2016, 5:49pm UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/9 "2016-03-21T17:49:00Z")

</div>

Ok i found the issue

i placed originalfilename instead of filename

it works now

sorry for the mistake

Thank you again

Martin

---

<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:24pm UTC](https://community.mp3tag.de/t/how-to-rename-filename/14098/10 "2026-02-09T12:24:10Z")

</div>

Closed on February 9, 2026, 12:24pm UTC


