simbiat/filename-sanitizer

Small class to replace common characters that are restiricted in filenames.

1.3.2+20230127 2023-01-27 12:38 UTC

README

Small class to replace restricted characters or combinations in filenames. Based on rules for Windows https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file but will be useful for *NIX systems as well.

This will also replace some characters, that may be harmful depending on where and how the files are used. If you want to disable that behaviour, call the sanitize function with second argument as false.

If you want to remove the characters/combinations instead of replacing, send true as third argument.