How to rename filename

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 :frowning: .
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

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%

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.

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 (1.77 KB)
DD.20121109.1242.CET

20121109.stanray.renumber.zip (1.77 KB)

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

Stanray

Ok and what about

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

Thank you

Both formatstrings work as designed, try again.

DD.20160321.1929.CET

I tried it with both formatstrings and it makes no change


Ok i found the issue

i placed originalfilename instead of filename

it works now

sorry for the mistake

Thank you again

Martin