Escapes a string to be used as a safe file or directory name.
It replaces any characters that are not allowed in file or directory names
with an underscore (_). It also ensures that the name does not exceed the
maximum length allowed by the operating system (255 characters).
On POSIX systems, it replaces / and null characters.
On Windows systems, it replaces < > : " / \ | ? * and control characters (0-31).
It also avoids reserved names like CON, PRN, AUX, NUL, COM1, LPT1, etc.
Escapes a string to be used as a safe file or directory name.
It replaces any characters that are not allowed in file or directory names with an underscore (_). It also ensures that the name does not exceed the maximum length allowed by the operating system (255 characters).
On POSIX systems, it replaces / and null characters. On Windows systems, it replaces < > : " / \ | ? * and control characters (0-31). It also avoids reserved names like CON, PRN, AUX, NUL, COM1, LPT1, etc.