Finder and using the characters / and :

simX

Unofficial Mac Genius
Has anyone else noticed that you actually CAN use the slash '/' character in the Finder, but that when you look at the folder/file using the terminal it shows up as a colon ':'? That's kind of weird, because the Classic Mac OS uses colons to do paths. But then I tried looking at the folder using the Classic Mac OS, and it comes up as slashes in the dialogs! What gives? How the heck can Apple accomplish this -- is it just something that is different when OS 9 is run in Classic than when run natively?

Also, what's even WEIRDER is that, despite the observations above, when you type a colon ':' in the Finder, it changes to a dash? What the heck? Why are slashes shown as colons to UNIX and slashes to the Classic Mac OS, but colons automatically revert to dashes? That's so bizarre.

Can anyone shed any light on this? (Please offer ANY info)
 
The only character you CAN'T use in a filename is a Colon. That's why they turn to hyphens in the finder. As for the Slash thing. I can't explain it.
 
The terminal is replacing the slash with a colon because terminal programs/scripts use the slash to seperate paths. If it keeps the user-entered-in-name slash, all those command tools would fail.
 
UNIXes use the '/' for paths. For example if you have a file in your home folder called 'foo.txt' its path (from an OS view) is

/Users/yournamegoeshere/foo.txt

That's why UNIX file systems - for example Apple's UFS - use the '/' for path info, too. So you shouldn't use that in file names.

HFS and HFS+ use the ':' for paths, so you shouldn't use that either in your file names.

Mac OS X is a strange breed, it uses HFS+ as its main file system. Good for compatibility, good for speed, bad for complexity though.

Best thing: Never use ':' or '/' in your file names and you should be fine. If you ever *have* to enter '/' or ':' in a Terminal because a file *does* have such a name (also for spaces) you can pretype a '\' for it. For example:

pico -w file\ with\ spaces\ in\ its\name.txt

But you can also do:

pico -w "file with spaces in its name.txt"

Takes a little getting used to, but the average user won't notice this in his lifetime, for the Finder just won't let him name files/folders in a way he shouldn't. Files from other operating systems that can have characters Mac OS X doesn't will just be renamed, basically.
 
Hmm, I think it's pretty simple; Classic Mac OS uses ':' for directories, and Mac OS X (and most other unixes uses '/' :)
 
Back
Top