I’ve been using Windows and Linux systems for years and I’ve never had a problem. I like spaces for readability purposes but I’ve also been told that they should be avoided. So, what’s the straight dope? Is my computer going to blow up some day?
Computer isn’t going to blow up, but spaces in file names can require extra steps to get things to work in the command line (like putting it in quotes so it doesn’t think the part after the space is part of a command parameter).
For readability purposes, I begin each new word with a capital letter and avoid spaces. (EnglishEssayOne.txt instead of English Essay One.txt). A document without spaces is more easily viewed on the web as well (I don’t have to remember to use %20 or whatever it was in the URL in place of the space).
Where did you hear that spaces should be avoided? I’ve been using spaces for years with never a problem. Of course, things like forward slashes and the like must be avoided, but the computer won’t let you use them anyway.
I liked DOS, but am not at all nostalgic for that 8 character limit in file names.
You may difficulty using some utilities and applications, or accessing the files from other systems that do not recognize spaces in file names. However your computer will blow up if you insert a special bomb character in a file name. This is character is entered with the special key combination ctrl+alt+left arrow.
You’ve probably used Windows and Linux in a graphical user interface environment, or else you already know the appropriate work-arounds in a command line interface (CLI) environment.
In most CLIs, the space is a word separator: it breaks up different “entities”, such as distinct option or file parameters.
wc -l foo bar baz
wc is the command
-l is an option
foo, bar, and baz are presumed to be three distinct files.
If your intent was to treat “foo bar baz” as a single file, you’d have a little trouble getting the shell (CLI interpreter) to understand that, since it assumes that the spaces are separators, not parts of the single filename you meant.
In most Linux shells, you can “escape” the spaces (tell the shell “this space isn’t for you, it’s part of the filename”) with a backslash in front of each:
wc -l foo\ bar\ baz
or wrap the whole filename in quotes, also telling the shell that the quotes are the part of the single filename (actually, telling the shell “whatever’s inside the quotes, it’s a single filename”):
wc -l “foo bar baz”
This latter trick works in Windows command lines, as well.
Stuff that gets interpreted “in the background” by tools that operate by CLI shell rules, like some web stuff, also falls afoul of the “spaces are seperators unless you tell me otherwise” rule.
SPACE in a file name might require the file name to be in quotes to be accepted.
when operating in MS-DOS window the SPACE is not a valid character.
If all you’re doing is creating and reading files on a GUI, spaces are fine.
If you need to do anything that uses the file names as data, you need to go through hoops in order to use filenames that include spaces (and some other special characters as well)
My rule of thumb is that filenames should include letters, digits, and the Underscore – which can be used instead of a Space character is having some daylight between words is important to you.
File Name With A Few Words.txt <-- This frankly makes my eyes hurt! But maybe it’s just me.
I fail to see a major visual difference between the second and third options. Do yourself a favor and use an underscore whenever you feel you really, absolutely need to put a space in a file name.
I use periods instead of underscore between words in filenames. This is for files used exclusively by Windows PCs. Is there any problem with doing so?
Probably not any more, but if you run into some really ancient software that expects a file name to look like <name>.<suffix> then you could run into a bit of trouble. Not likely in this day and age (note I don’t think one has to accommodate the possibility of a program requiring a 3-letter suffix any more!) but better safe than sorry.
Yes, but most of those programs are also going to expect eight-character filenames.
This helps. Thanks. Yeah, I started back in the bad ol’ days with Dos and when CLIs came out, I never looked back. I will on occasion resort to the terminal when necessary, but I’m seldom happy about it.
I wish we were in BBQ Pit, because long filenames with special characters make me want to puke. I do a lot of “command line” work, and the characters need to be escaped.
Also annoying is the way Windows makes filename extensions invisible, in some situations.
BTW, twenty-odd years ago a friend was writing a story using WordStar. He asked me for help because, although he kept saving the latest version, it in fact was soon overwritten with an earlier version, and he had to re-enter text. The problem was a space in his filename: one WordStar dialog could handle the space, another couldn’t.
[Hijack]Yeah, fuck Redmond up the ass with a red-hot poker for this. The first thing I do (probably, literally the first thing) on a new Windows box is start up File Explorer and disable the “hide known suffixes” [del]feature[/del] bug.
Oh, and the second thing I do is install some other browser.
I tried adding backspaces to a filename, but got an error message that it was too short.
I didn’t know this was an option. :smack:
… And Googling now, it appears it is some absurd 2-step option. :smack:
I’d start a BBQ Pit thread explaining why Unix was() infinitely superior to Windows except I know from experience the most computer-illiterate Dopers would show up, shrilly defending Windows.
( - I write “was” rather than “is”, because in some perverse race-to-the-bottom, the Linux user interface is evolving to emulate the Windows “philosophy” as closely as possible. :smack: )
If you just want to disable this… behavior… permanently (Assuming Windows 7), open Explorer, “Organize”, “Folder and Search Options”, Switch to “View” tab, uncheck the “Hide extensions for known file types” check box, and Cello! (er, viola! … or something :D)
Actually, Windows 7 / Server 2008 are both decent (not great) operating systems. The “DOS emulation” shell still sucks for getting down-and-dirty with the internals, however.
Seconded. While you might like periods or spaces between words, the underscore symbol is the only safe one, rooted in computing antiquity.
And while we’re at it, very long filenames can cause problems, too. Stay below 64 characters; 32 is even better. If you need more, you’re probably misusing the concept of a name. Write your essay in the body of the file, not the title!
Amen to most of the above. I work on UNIX systems, and just last week I wrote a script to convert really ugly filenames (not just spaces but parens and # also) to something reasonable. I’ll be automatically downloading a ton of these things, and don’t want to have to bother quoting or escaping them to do anything useful.
I don’t think modern Windows will have any problem, but some mail filter software might object if you try to send any of those files as attachments. A common tactic of viruses which spread by email is to attempt to hide their true extension, so they appear to be harmless: Funny-cat-video.mpg.exe <- really an executable, not a video versus First.quarter.report.xls <- totally legit email attachment.
I’m not saying you will see these problems, but in an attempt to prevent viruses so new they are not yet in definition files, blocking on “suspicious” names is a strategy some mail filters take.
It’s funny, if I send a .tar.gz via gmail it warns me “the usual extension for a file of this type is .tar.gz, not .gz, would you like to fix before sending?” If I say yes it “fixes” the file to a .tar.tar.gz.