Filenaming script, replace space with underscore

Tags: #<Tag:0x00007f58ef330258>


I have this file naming script:

%discnumber%$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%

It works good, but I don’t want spaces in the filenames, because I use Linux.
How can I make it so that the spaces in the filenames are replaced by underscores?

i copied this script from somewhere, and don’t know anything about scripting.
Thanks in advance.

I believe this should do it:

$replace(%discnumber%$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%, ,_)


I have tried it, and it works, thanks!

1 Like

Just curious, what is the issue there?

When you use the command line you can’t use spaces in filenames, you have to use quotes or type a \ instead of a space.

Ahh, sure, I was confused as that’s the same on all *nix platforms, and I think one can only use quotes with the long names on MS OSs.