Replace some chars to " - "


Im looking for some help, I want to change any of illegal filename chars (like ":", "*", "", "/", etc) for a " - ".
Some tags have this chars, and then when I convert Tag to Filename, they are replaced with "". But then I want to replace with " - ".

How can I do that?


Please have a look in the help-file "main_scripting.html":

$validate(filename, to)

Example: $validate(%artist% - %album% - %track% - %title%,-)

Thats the "magic" command. :wink:


thanks for the answer

but there is a way to replace only ":" and "/" for " - " ?

because tags with "?", for example, I want to leave as "" (blank) in filename.


Your initial question was about valid filenames. :huh:

You have to change this characters /?*"<>|: to something else. Otherwise, you can't save it to the filename.

What you can do, to replace single chars in all tagfields, is executing an action like this:

Aktionstyp: Ersetzen
Feld: _ALL
Original: ?
Ersetzen durch: <-- Enter a !

This will replace the character ? in ALL tagfields with a
(If you wanna rename the ? only in TITLE, replace _ALL with TITLE.
If you wanna rename the : with a - just replace the ? and in the fields above)

Then you can rename your mp3 according to the changed tagfields like this:

Aktionstyp: Tag-Felder formatieren
Formatstring: %album% - %artist% - %title%
(or whatever fields you like to use...)


I've found a way to do what I want:
I created a new action group, called tag-filename
then I add the following:

Format value
Format String: %TRACK% - $caps2(%TITLE%)

then, in the same action group:

Replace with regular expression
Regular Expresion: "/" (without quotes)
Replace matches with: " - " (without quotes)

then add a new Replace with regular expression, modifying the "/" with ":" and the " - " with " -"

this will replace all filenames with format like this "02 - Song Title"

I don't know if there is a simple way to do this, but for now, it fits my needs :slight_smile:

So there is another question
I found that $caps2 its the best case conversion method, cause it leaves some upper case senteces like they should be, not capitalizing only the first letter like the "case conversion - mixed case" action does

So then I want some kind of case conversion that is like the $caps2, but I need that the first letters after " (_-/ " capitalize too, a feature that the case conversion action has, but $caps2 does not.

For example, a title like "Rock in the USA (yeah!)":

with $caps2, it becomes "Rock In The USA (yeah!)"
and with cave conversion action, "Rock In The Usa (Yeah!)"

When it should be like "Rock In The USA (Yeah!)"

I have trouble to to the coding =|

help me please!