Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ElectricMan5

macrumors regular
Original poster
Jul 22, 2008
204
0
Is there anyway we can enable the use of colons :)) in file names?

It drives me crazy that we can't use them... But there has to be some system file that lets me change what I can use and what I can't. Thanks!
 
There is an odd little dance that the file system does around the ":" and "/" characters. The former is used through the POSIX APIs (think: command line), and the latter is used in the Finder. They are actually the same character (two expressions of the same thing).
 
Ok, here's the deal as I've understood it. The Classic Mac OS used colon to divide directories in file paths. However, UNIX has always used the slash. What's OS X to do.....well, it uses slashes. Finder, in an attempt to make the two worlds match, secretly changes the colons you type into slashes, and displays the slashes in the file system as colons.

I may be wrong on a few details, but I think that is the gist of it.
 
Just don't do it. Technically, it is possible to create a file with a ":" in it, using Terminal. It is a special character and needs to be escaped with a "\".

$ touch foo\:.c
$ ls

You'll see it there, however, it won't show up correctly in Finder. Delete it by doing a "rm foo\:.c".

OSX is a POSIX operating system. I can't remember the exact posix rules regarding what can and cannot be used in a filename, but it is a good idea to just never use a ":" in a filename, or any other character that requires it to be escaped. I don't even use spaces in filenames for the same reason.

Yes, the ":" was used as the path separator character but only for the classic mac os. OSX is now posix, so like all unix operating systems, the "/" is now used.

If I have a file where I would normally want a ":" in it, I'll use a "-" or "," instead. Those characters are no problem.
 
You can use colons in filenames:
Code:
bstreiff@fenchurch:~$ echo "blah" > "foo:bar"
bstreiff@fenchurch:~$ ls -l foo:bar
-rw-r--r--  1 bstreiff  bstreiff  5 May 24 10:02 foo:bar
Just expect lots of problems when you attempt to use files like that (Finder displays the file as "foo/bar", and I can imagine plenty of applications not being able to open the file successfully).
 
You can use colons in filenames:
Code:
bstreiff@fenchurch:~$ echo "blah" > "foo:bar"
bstreiff@fenchurch:~$ ls -l foo:bar
-rw-r--r--  1 bstreiff  bstreiff  5 May 24 10:02 foo:bar
Just expect lots of problems when you attempt to use files like that (Finder displays the file as "foo/bar", and I can imagine plenty of applications not being able to open the file successfully).

Oi. Thanks for the answers guys, except I couldn't understand any of that UNIX stuff :eek:

I mostly want to use them in folder names, such as Halo 2: Combat Evolved and WoW: WotLK. I know that using a "-" can work, but I get tired of them sometimes.

Thanks for your help :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.