warg.os_utilities.path_functions.sanitise_path

warg.os_utilities.path_functions.sanitise_path(path: Path, naughty_directory_symbols: Iterable[str] = (' ', ',', '<', '>', '"', '|', '?', '*'), replacement_symbols: str = ('_',), preserve_file_suffix: bool = True) Path[source]

Opinionated path sanitisation

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

preserve_file_suffix: assumes any path with a suffix at the end is a file and will preserve it but still replace naughty symbols