Here is the list of possible candidates:
Oct Dec Hex Name 040 32 0x20 space 041 33 0x21 !, exclamation mark 042 34 0x22 ", double quote 043 35 0x23 #, hash 044 36 0x24 $, dollar 045 37 0x25 %, percent 046 38 0x26 &, ampersand 047 39 0x27 ', quote 050 40 0x28 (, open parenthesis 051 41 0x29 ), close parenthesis 052 42 0x2a *, asterisk 053 43 0x2b +, plus 054 44 0x2c ,, comma 055 45 0x2d -, minus 056 46 0x2e ., full stop 057 47 0x2f /, oblique stroke
/
is reserved by FS. Space is hard to see. Quoting characters require awful quoting.
!
is used for history expansion by shells in interactive mode.
#
at the beginning of word is comment syntax in shell.
$
used for variable substitution in shells.
&
is command separator in Windows CMD and control operator in shells.
(
and )
have special meaning in shells along with *
.
*
, .
, +
are special in regex.
-
is used as marker of comand argument. Usage of special agreement to supply file list after
--
or prefixing like ./-
is common technique to allow -
as file prefix.
%
should be quoted in URL and have special meaning in Windows CMD and environment variables.
Dot is safe as prefix in file name but solely .
and ..
have special meaning for FS and it
should be qouted in regex.
The winner is comma ,
although it is hard to distinguish from dot sign. You may see comma as
prefix in a Lisp special backquote syntax.
Some tools uses comma as field separator. For example in Ant build tools this:
<fileset dir="." includes="**/*,*.xml"></fileset>
should be replaced with:
<fileset dir="."> <include name="**/*,*.xml" /> </fileset>
because ,
have special meaning when used in includes
attribute.
Another pretty safe prefix is a plus sign except that it requires escaping in regex.
GNU Coreutils have utility that checks file names for safety:
$ cd $DIR $ pathchk --portability **/*
- https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words
-
List of reserved characters prohibited in file names.
- https://support.apple.com/en-us/HT202808
-
OS X: Cross-platform filename best practices and conventions.
- https://msdn.microsoft.com/en-us/library/windows/desktop/aa368590.aspx
-
Filename on Windows.
- http://unix.stackexchange.com/questions/155793/is-it-correct-to-use-certain-special-characters-when-naming-filenames-in-linux
-
Is it correct to use certain special characters when naming filenames in Linux?
- http://superuser.com/questions/358855/what-characters-are-safe-in-cross-platform-file-names-for-linux-windows-and-os
-
What characters are safe in cross-platform file names for Linux, Windows and OS-X.