Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Invalid characters for Windows filenames
Information from https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx :
Use any character in the current code page for a name, including Unicode
characters and characters in the extended character set (128–255), except
for the following:
- The following reserved characters:
< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
- Integer value zero, sometimes referred to as the ASCII NUL character.
- Characters whose integer representations are in the range from 1 through
31, except for alternate data streams where these characters are
allowed. For more information about file streams, see File Streams.
- Any other character that the target file system does not allow.
- Do not use the following reserved names for the name of a file:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8,
COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9.
Also avoid these names followed immediately by an extension; for
example, NUL.txt is not recommended.
- Do not end a file or directory name with a space or a period. Although
the underlying file system may support such names, the Windows shell and
user interface does not. However, it is acceptable to specify a period
as the first character of a name. For example, ".temp".
---
Handy list to copy/paste:
<>:"/\|?*
---
Note: Other OSs and file systems may vary; but in general, the only forbidden characters
in filenames on Unix-like systems appear to be the forward slash (/) and the null byte.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.