Stripping invalid characters from new path

All about user-defined episode / movie / file name format expressions
Post Reply
Jorm
Posts: 20
Joined: 21 Apr 2021, 08:44

Stripping invalid characters from new path

Post by Jorm »

Hi,

If / isn't stripped out under Linux then I don't know why : is, : is as far as I know only invalid under MacOS (most likely due to backward compatibility as not invalid under BSD), it would be neat if OS was detected and : was keept where it's a valid char.

Code: Select all

Stripping invalid characters from new path: 24 (2001)/Season 07/24 (2001) - S07E01 - Day 7: 8:00 A.M. - 9:00 A.M. - [720p]
not ending up 
24 (2001)/Season 07/24 (2001) - S07E01 - Day 7 800 A.M. - 900 A.M. - [720p].mkv
Jorm
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Stripping invalid characters from new path

Post by rednoah »

If you want to explicitly allow : and friends in your file paths because you run only Linux, then you can use the -unixfs command-line flag:

Code: Select all

-unixfs                                : Allow special characters in file paths

:idea: If / was stripped, then you'd end up with a very long file name, and not a folder structure. ;)


:idea: FileBot behaves the same on all platforms by design, i.e. FileBot will create Windows-compatible file paths on Linux by default. It's very common for users to run FileBot on a Linux server and then access the files from a Windows device via network shares.
:idea: Please read the FAQ and How to Request Help.
Jorm
Posts: 20
Joined: 21 Apr 2021, 08:44

Re: Stripping invalid characters from new path

Post by Jorm »

rednoah wrote: 28 May 2021, 15:59 If you want to explicitly allow : and friends in your file paths because you run only Linux, then you can use the -unixfs command-line flag:

Code: Select all

-unixfs                                : Allow special characters in file paths
Thanks for that one will use ASAP in my little script, hehe your one nice dude -- normally u get a RTFM :) me being lazy..
rednoah wrote: 28 May 2021, 15:59 :idea: If / was stripped, then you'd end up with a very long file name, and not a folder structure. ;)
No what I mean it wasn't stripped out in some radiator spring name, causing some funny names :), hence my question why the : and the even the * was... but the answer is below...
rednoah wrote: 28 May 2021, 15:59 :idea: FileBot behaves the same on all platforms by design, i.e. FileBot will create Windows-compatible file paths on Linux by default. It's very common for users to run FileBot on a Linux server and then access the files from a Windows device via network shares.
Unix my whole life and so all my kids and our family computers but that is a side note. Samba will take care of your illegal chars but I guess it's easier and most likely prettier to use stripping.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Stripping invalid characters from new path

Post by rednoah »

Jorm wrote: 28 May 2021, 18:37 Thanks for that one will use ASAP in my little script, hehe your one nice dude -- normally u get a RTFM :) me being lazy..
RTFM is implied naturally when copy & pasting from filebot -help. No need to be explicitly rude about it. :lol:

Jorm wrote: 28 May 2021, 18:37 No what I mean it wasn't stripped out in some radiator spring name, causing some funny names :), hence my question why the : and the even the * was... but the answer is below...
Well, all / are made equal, so Radiator/Season 1/Radiator 1x01 Half 1/2 Time might look obvious to a human but for FileBot the good / is indistinguishable from the bad / based on the file path generated by your format alone. Top level bindings such as {n} and {t} naturally strip / on access, because in the context of series name or episode title the / is known to be bad, i.e. {t} never contains / characters. But the / characters introduced by your format - generated by correct code or buggy code, for better or worse - come in the context of a file path, and so / are perfectly valid there. We can strip all of them, and allow file name rename only. We can strip none, and allow arbitrary file path rewrite. The former is too limiting, so we must do the latter.
:idea: Please read the FAQ and How to Request Help.
Post Reply