Replace underscores with spaces

I’ve been digging through posts here but having no luck making it happen.
I’m going through a huge collection of music and a ton of them have underscores in the album name or folder name.
I hate underscores and prefer " - " between album name and subtitile - i.e.
“Country Legends - Great Duets/Artist - Title.mp3”
I seem to be cleaning up the artist and title names, but what’s killing me is the album and subtitle.
%album% in this case returns “Country Legends_Great Duets”
%discsubtitle% returns “Great Duets”
I haven’t seen anything in the tags about the disc title separate from album?
I’ve tried replacments and windows compatibility in Options but the best I wind up with is “Country Legends- Great Duets” or “Country Legends Great Duets”
I just can’t seem to get " - " in there

Adapted from a prior post by @outsidecontext:

The underscores are added for characters not allowed in Windows filenames. You can either completely remove them or set them to something different with scripting. Try doing something like this in your filenaming script:

$set(artist,$rreplace(%artist%,[“:<>?|],) - )
$set(album,$rreplace(%album%,["
:<>?|],) - )
$set(title,$rreplace(%title%,[”*:<>?|],) - )

The part just before the last bracket is where you can enter ‘ - ‘ or whatever separator you would like to use (or nothing, to just remove the underscores entirely).

You can also check that Options > File Naming > Compatibility > Replace spaces with underscores isn’t ticked (that’s more for if someone else stumbles across this post)

2 Likes