Page 1 of 1

How to replace / \ in file (episode naming)

Posted: 07 Mar 2026, 13:49
by ShadowTheGreat2
I have been using the following string and it has worked flawlessly for my needs. I have run into an issue though, Using the TVDB, at times there are episode names that will sometimes use the forwardslash or backslash (/ or \). I want to continue using the following string but have it be able to replace the forwardslash and backslash symbols to an "and" symbol instead (&) in addition to it's current function.

Format: Select all

{(n + '.'  + s00e00 + '.' + t).replace('<':'﹤','>':'﹥',':':'꞉','"':'“','/':'⁄','|':'⼁','?':'?','*':'﹡','\\':'∖') }

Re: How to replace / \ in file (episode naming)

Posted: 07 Mar 2026, 16:16
by rednoah
:?: Which series / episode are you testing with?

:idea: Note that all top-level bindings such as {t} are sanitised preemptively, i.e. cannot contain / or \ and thus cannot introduce accidental file / folder structure.

:arrow: You can use {episode.title} if you need the raw episode title value:

Format: Select all

{ episode.title.replaceIllegalCharacters() }

Re: How to replace / \ in file (episode naming)

Posted: 07 Mar 2026, 17:55
by ShadowTheGreat2
Here is an example of what I am wanting to do

TVDB lists this episode as: Overkill/Left for Dead

{(n + '.' + s00e00 + '.' + t).replace('<':'﹤','>':'﹥',':':'꞉','"':'“','/':'⁄','|':'⼁','?':'?','*':'﹡','\\':'∖') }
(the string above) = The First 48.S01E02.Overkill Left for Dead

If possible, I would like to have the episode be renamed to: The First 48.S01E02.Overkill & Left for Dead

Re: How to replace / \ in file (episode naming)

Posted: 08 Mar 2026, 05:53
by rednoah
e.g.

Format: Select all

{ n }.{ s00e00 }.{ episode.title.replace('/':' & ') }

Code: Select all

The First 48.S01E02.Overkill & Left for Dead

Re: How to replace / \ in file (episode naming)

Posted: 08 Mar 2026, 21:30
by ShadowTheGreat2
Thank you for replying to my questions

If I am understanding you correctly I would need to use this string for 99% of my renaming needs

Format: Select all

{(n + '.'  + s00e00 + '.' + t).replace('<':'﹤','>':'﹥',':':'꞉','"':'“','/':'⁄','|':'⼁','?':'?','*':'﹡','\\':'∖') }
I will need to swap out the string with this for the other 1% that I would need

Format: Select all

{ n }.{ s00e00 }.{ episode.title.replace('/':' & ') }
I would not be able to combine both strings together for 100% for my needs, correct?

Re: How to replace / \ in file (episode naming)

Posted: 09 Mar 2026, 04:59
by rednoah
ShadowTheGreat2 wrote: 08 Mar 2026, 21:30 I would not be able to combine both strings together for 100% for my needs, correct?
You can of course integrate my simple example code into your production code:

Format: Select all

{(n + '.'  + s00e00 + '.' + episode.title.replace('/':' & ')).replace('<':'﹤','>':'﹥',':':'꞉','"':'“','/':'⁄','|':'⼁','?':'?','*':'﹡','\\':'∖') }