Convert filename with replace

Good morning,

i need some help for this:

  • My original tag formatting

Artist: TRIUMVIRAT
Title: e minor 5/9 minor /5: broken / head over heels / broken

  • file name required after conversion Tag ---> Filename

required file name: TRIUMVIRAT-e minor 5_9 minor_5: broken_head over heels_broken

name of the file that appears: e minor 59 minor 5 broken head over heels broken

I tried: %artist%-$replace(%Title%,': ','_','/','_'' / ','_') but there are some problems with the spaces

Thank you for your help

Can you edit your post to enclose the format string in backticks `, e.g., `my format string` so that spaces and other special characters are preserved?

1 Like

I doubt that this filename will work in Windows. AFAIK the colon is not allowed as part of the filename but only to define the drive letter.
Did you have a look at the function $validate()? It looks to me as though you want to replace any illegal character with an underscore. This could be achieved with
$validate(%title%,_)
and in respect to the $replace() function: you have to define pairs, e.g. if you want to replace the ": " with "_" and " /" with _ the syntax would be replace(%Title%,: ,_, /,_).
I your code example I think there is at least one incomplete pair and it also looks to me as though you defined a list of characters and then put the resulting character last.

1 Like

Good morning,

Thanks for your quick response and successful solution.

The format: $validate(%artist%-%title%,_) is the best solution.

My best regards

caffca

It also works using the $replace format

$replace(%artist%-%title%,:,_, / ,_,/,_,)

Artist-Title: JAMIE ISAAC-(4:30) idler / sleep ->
Filename: JAMIE ISAAC-(4_30) idler_sleep.mp3

Artist-Title: RÖYKSOPP-40 years back / come ->
Filename: RÖYKSOPP-40 years back_come.mp3

Artist-Title: STING & SHAGGY-44876.mp3 ->
Filename: STING & SHAGGY-44_876.mp3

Thanks again

caffca

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.