George Reith
George Reith

Reputation: 13476

Which characters are safe to name files and directories with?

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

Such as the following I know are not allowed in a windows filename:

*<>[]=+”/

Is there a list of characters that ether can or be can't used as universally as possible? (Don't worry about obscure operating systems; Windows,Linux and OS X are sufficient)

Thanks

Upvotes: 4

Views: 517

Answers (1)

G-J
G-J

Reputation: 107

For best portability, it is usually wise to restrict filenames to letters of the alphabet, numbers, dashes (-) and underscores(_).

Although spaces in filenames are standard under Windows, and treated correctly in POSIX filesystems (e.g. Linux and OSX), they are often frowned upon in POSIX systems, because they need to be treated with a bit more care when using some command line tricks.

Also, keep in mind that Windows [NTFS] is case-insensitive (although it does preserve the original case of the filename). In other words, "MyFile.txt" will have its "camel caps" preserved, but will be overwritten if you create a file called "MYFILE.TXT".

Upvotes: 2

Related Questions