What characters might be used to substitute for colon in folder names using a time-of-day? [closed]
It is often convenient to name files and folders with a date and time, such as standard ISO 8601 format: 2014-12-10T22:35:28.460Z
.
Unfortunately, the Mac’s HFS+ file system uses the COLON as a path separator just as Unix-like OSes use SOLIDUS /
(slash) and Microsoft OSes use REVERSE SOLIDUS \
(backslash). All three characters must be avoided when naming a file or folder for compatibility.
What character might be commonly used as a replacement for the COLON?
- Using a HYPHEN
-
makes it tricky to programmatically reverse the conversion to standard format. - Similarly, using a FULL STOP
.
(period) makes reverse conversion difficult as they will be misinterpreted as fractional seconds.
For example, when programming in Java 8 on OS X Mountain Lion, calling File::mkdir()
for string 2014-12-11T21:33:08
results in a folder named 2014-12-11T21/33/08
.
ISO 8601 “Basic” variation
You can avoid using the colon by employing ISO 8601 “basic” format strings (YYYYMMDDTHHMMSSZ
) for naming files and folders. The standard allows for the separators to be omitted from the YYYY-MM-DDTHH:MM:SSZ
format.
So both of these examples are valid under the standard:
2016-03-27T07:01:02Z
20160327T070102Z
If you need to process those strings with certain programming or scripting languages then maybe you have to convert them to the extended format that incorporates separators (hyphens, colons) and time zone info.
International standard date and time notation - "If a date and a time value are stored together in a single data field, then ISO 8601 suggests that they should be separated by a latin capital letter T
, as in 19951231T235959
". So the T
in the middle is optional (19951231235959
) but suggested.
The raised colon, Unicode 0x02F8 ( raised colon ˸ vs colon : ) would not be interpreted as a separator by Finder or other scripts. (More info about the raised colon here: http://www.charbase.com/02f8-unicode-modifier-letter-raised-colon )
The way to enter that character varies, depending on your OS X version. More details can be found at Apple's support page: http://support.apple.com/en-us/HT201586
I've investigated this too. Most of the alternative glyphs with the word 'colon' in the description are decidedly unattractive as a colon replacement (˸
, ܄
, ﹕
, ᠄
, :
, ︓
, and ꞉
).
There is another alternative that at least has a similar character width to the original colon - the mathematical symbol for a ratio: ∶
. It looks great in a number of monospaced fonts, but it is a little small in the default MacOS system font.
Here it is being used in a file name:
/Users/me/Books/Book Title: Book Subtitle.pdf
[restricted colon glyph]
/Users/me/Books/Book Title∶ Book Subtitle.pdf
[permitted ratio glyph]