Which characters to avoid in file and path names

The allowed set of characters within files and folders depends on the operating system.

What would be “best practice” for the naming of files and folders in public Julia projects and packages?

https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names

1 Like

: is definetly a problem on Mac OS (also own experience when using NextCloud with non-mac-users), see What characters are forbidden in Windows and Linux directory names? - Stack Overflow

Not only characters but also file names, as indicated at that link. Also be careful in not using names that are different only in uppercase/lowercase, I had issues with that, although that is safe in Linux.

As a simple rule, I would personally stick with filenames that are valid Julia identifiers, with the addition of -, with the proviso they must be distinct regardless of case. (Most people stick with the ASCII subset thereof.)

(That also means no spaces, which are valid paths but can cause problems with incautiously written shell tools.)

1 Like

I don’t think this is Julia specific at all. The answer depends on which OS and filesystems you use.

[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)? is usually a safe bet everywhere nowadays as case-insensitive HFS+ is disappearing in the wild, but perhaps too conservative.