What characters are safe for file and directory names?

I understand that different operating systems use different characters for functions.

Names like I know are not allowed in the Windows file name:

* <> [] = + "/

Is there a list of characters that may or may not be used by the ether, as versatile as possible? (Donโ€™t worry about obscure operating systems, Windows, Linux and OS X are enough)

thanks

+4
source share
1 answer

For better portability, it is usually wise to limit file names to letters of the alphabet, numbers, dashes (-), and underscores (_).

Although spaces in file names are standard on Windows and correctly handled on POSIX file systems (e.g. Linux and OSX), they are often underestimated on POSIX systems because they need to be handled with more care when using some command line tricks.

Also, keep in mind that Windows [NTFS] is case-insensitive (although it retains the original case of the file name). In other words, โ€œMyFile.txtโ€ will have its own โ€œcamel caps,โ€ but will be overwritten if you create a file called โ€œMYFILE.TXTโ€.

+2
source

Source: https://habr.com/ru/post/1389255/


All Articles