3

Just noticed it works on Maverick.. the colon character : is valid for file and directory names (I accidentally entered it for a filename in Atom).

Can't find any reference to it becoming valid though (http://en.wikipedia.org/wiki/Hierarchical_File_System still marks it as invalid).

It works in the Atom editor.

I can create a file called : with nano.

This works echo 'test' > : && cat :

In TextWrangler it only works if the file already exists but won't create it (with command line tools installed edit :)

Is this new from Mavericks? Works in Yosemite? Before?

Edit: A few more tests:

  • TextEdit won't allow me to enter it and always replace it with -

  • Finder won't allow me to create a folder with the name : Finder Screenshot

  • A : file created via command line is displayed as / in Finder.. and double clicking it will open it in TextEdit. TextEdit will load its content but show the name / in the title bar.

  • 2
    ":" is allowed in unix-heritage APIs (and "/" used as a path delimiter), while "/" is allowed in MacOS-heritige APIs (and ":" used as a delimiter), and the two are swapped as needed depending on context -- see this previous question and the linked usenix paper. – Gordon Davisson Feb 19 '15 at 5:42
  • So the wikipedia article on HFS is technically wrong then..? – Ben Feb 19 '15 at 21:54
  • 1
    I don't see an error there; it'll actually be stored as "/" on the physical disk, translated into ":" in the filesystem driver (part of the kernel), then translated back to "/" for the MacOS-heritage APIs. So on an HFS+ volume, it's "truly" a "/". – Gordon Davisson Feb 20 '15 at 2:16
1

This is due to the difference in command line and GUI. As pointed out in the above comment, colon (":") is allowed in UNIX/BSD since the directory delimiter is slash ("/"). In the GUI, the delimiter is colon and slash is allowed as a character for a file.

Mac OS X interchanges those characters depending on where you view them.

So, if a file is viewed in command-line, it shows colon. If it is viewed in the GUI (e.g. Finder or TextWrangler), it shows slash.

In other words: You could use TextWrangler to create a file named "/" and then later view that same file in command-line, where it would be displayed as ":".

Generally, I would avoid using either of the characters, if not required by a specific naming convention. In the end, it is a file name and does not affect the contents of that file. Using an underscore (oldskool) or a space character would be recommended.

  • You cannot use TextWrangler to create a file named "/" – Ben Feb 19 '15 at 21:52
  • "In the GUI, the delimiter is colon" is also wrong.. or ambiguous – Ben Feb 19 '15 at 21:56
  • I have not tried it myself, but I am sure that you can create a file inside the GUI which contains the letter "/". On the other side, you cannot create a file inside the GUI which contains the letter ":". Either it is flagged during the attempted save or it is converted to a friendlier character (depending on the application used). Considering the "Finder path" colon IS the delimiter. You can try writing an AppleScript. If not specifically told otherwise or meant for the command-line, the colon-separated notation is what is expected. Using UNIX's slash will fail if not converted. – Phoenix Feb 20 '15 at 13:14
1

This change appeared at the beginning of MacOS X (i.e. MacOS X 10).

Then the directory separator from HFS : was changed to the directory separator of UFS /. Since then the Finder is in charge of making the following mapping:

/ → :
: → /
  • I wonder why they still bother doing the mapping.. the filesystem clearly supports it.. it's only the GUI apps that adopt a weird fall back behaviour.. – Ben Feb 19 '15 at 21:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .