Advantage of underscore in filenaming

A lot of people I have worked with are keen on using underscores in folder and file names? Why is this?

mac pro, Mac OS X (10.5.5)

Posted on Nov 15, 2008 11:26 AM

Reply
10 replies

Nov 15, 2008 11:39 AM in response to tmx3

A lot of people I have worked with are keen on using underscores in folder and file names? Why is this?


You mean instead of spaces, right? If so, the reason might be to avoid situations like urls where spaces get turned into %20. Or problems if a file name comes at the end of a line of text. Or apps or search engines that don't like spaces in filenames. I think some recommend hyphens as better than underscores.

Nov 15, 2008 11:38 AM in response to tmx3

Back in the day, there were concerns about using "special characters" in filenames, because not all Operating Systems treat them the same way. Things like spaces, extra periods and commas had the potential for causing problems whenever a file was transfered from one OS to another (say, from Mac OS X to Windows). Even now, putting a space in the name of a file that is destined to be on a website URL isn't a good idea.

And so, some people will put underscores (_) or hyphens âž– instead of spaces in filenames to help avoid these issues.

Nov 15, 2008 12:01 PM in response to scaredpoet

scaredpoet wrote:
And so, some people will put underscores (_) or hyphens âž– instead of spaces in filenames to help avoid these issues.


And on these boards one needs to escape a hyphen thusly: (- ) or ( -) or you get this: ➖ 🙂

Yes most computer systems regard a space as a separator and most likely early on, the underscore was one of the few non-standard "characters" that were useable to create something that looks like a space but is not. Hyphens are not as good since they also occur in normal words and are used by the computer to flag something special coming up. The underscore was innocuous and spacey looking.
We have not even touched upon the use of Caps inside words which began in the programming world and has now spread to the rest of the world.

Nov 15, 2008 2:45 PM in response to nerowolfe

We have not even touched upon the use of Caps inside words


Yep, that's what I do. Instead of naming a jpeg something like this: red rose.jpg, I call it RedRose.jpg. And that's because I use the Terminal a fair amount and don't want to have to specify the file by either "red rose.jpg" or red\ rose.jpg. The problem is that in UNIX CLI the space means something to the shell, so you have to escape it one way or the other so that the shell "sees" the space as part of the file or folder name rather than as a separator in the command.

Furthermore, a huge portion of the Internet is served up from UNIX based servers, and as an old fashioned web master, writing html by hand, it was just easier to have all my files web safe by not having spaces in their names, so even before OS X came along with the option to access its UNIX heart with Terminal I had already gotten in the habit of eschewing spaces in file names. I suspect that is true of lots of people.
Francine

User uploaded file
Francine
Schwieder

Nov 15, 2008 4:25 PM in response to Francine Schwieder

Early versions of MS OSs did not allow the use of spaces in file names. Now they do.
When I come across a file or directory name with a space, my last resort is to escape it; I usually use the wildcard to avoid extra typing.
If the file name is This File
I cd or ls or whatever to Th* or whatever is the first unique set of characters that delineates the name.
I guess I am just lazy 🙂
And yes if I intend a rm This File, by using rm Th* I always first to an ls Th* and if it's OK recall the line and replace ls with rm. I am lazy, but very careful 🙂

Nov 15, 2008 4:28 PM in response to nerowolfe

Lol. Same. I type as little as I need to in order to accomplish the task at hand.

I don't like to think of people like you and me as lazy, but rather efficient.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Advantage of underscore in filenaming

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.