Is there a canonical way to write decimal marks in a filename? Dots, commas and apostrophe symbols are problematic.
Forgive me if this has been asked before, but I couldn't find anything similar. Maybe I didn't know how to look for it.
Decimals are allowed, however colons (":") are not.
Illegal Filename CharactersDon't start or end your filename with a space, period, hyphen, or underline. Keep your filenames to a reasonable length and be sure they are under 31 characters. Most operating systems are case sensitive; always use lowercase. Avoid using spaces and underscores; use a hyphen instead.
The decimal numeral system (also called the base-ten positional numeral system and denary /ˈdiːnəri/ or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numeral system.
Windows (7; probably relevant to later versions)
Through experimentation I have discovered that you can name files with "." in them as long as the file extension is after the last ".". For example:
".qerg..docx" is an acceptable file name, while "..rwhg..docx." is not.
Here I have a picture of a .txt file I named "...":
Macintosh OS 9
Decimals are allowed, however colons (":") are not.
Macintosh OS X
Same rule as Mac OS 9, however file or folder names are not allowed to begin with a decimal.
Unix
The characters not allowed in Unix file and folder names are slash ("/") and NUL ("\0"), however in most Unix shells these characters (\ ? * | " < >) need to be escaped with a backslash, for example:
The file name:
What is > life?
Would need to be entered into the shell as:
What\ is\ \>\ life\?
Further reading:
There is a helpful Wikipedia article about your question here.
Either put the filename in quotes:
$file="abc.def"
Or use an escape character ( which varies with OS )
copy data.txt to qwe\.rty
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With