Did you ever wonder why computer programmers have such quirky ways of naming files?  Or why they seem neurotic about backups?

Well, different types of programs, for various reasons, restrict what you can do with file names.  If you “break the rules” you can mess up code that would otherwise work, or (more commonly) just bring things to a grinding halt altogether.

And as for backup neorosis?  Well, that’s easy to explain.  In fact, you already know this.  All you have to do is lose several hours of mind-numbing work, and you’re a fan of backups.  OK, some of us may have to repeat this experience a few times, but we do learn eventually….

This is an exceprt from an instructional article I’m writing – it may be helpful to those who are just getting started with HTML, or editing / uploading files to a server via a file manager program.

About file names: In most web applications, file names are case-sensitive, and don’t allow spaces. Since you have to mush words together (no spaces), some people like to use capital letters to make them more readable, like this:

myDocument.html

whatWeDidLastSummer.html

These examples are perfectly legal, though the second one is really too long. Here’s another way to do the same thing without capitalizing.

my_document.html

what_we_did_last_summer.html

This is also perfectly OK. In this case, I used an underscore between words. Hyphens are allowable, but not commonly used. The key is to be consistent, because when the server looks for the file, it has to be entered exactly right, including any caps and underscores.

About saving files: On web sites, when you upload a file to the server, if there’s an old version in place (and there should be), that version is automatically over-written. That means it’s gone forever. For this reason, you have to be sure your changes are correct. Since we all make mistakes, it’s good to have a backup file.

So, let’s say you are editing a file called myDocument.html I recommend first creating a file called myDocumentBak.html as a back up. Then you go back to myDocument.html and make your changes. If something goes horribly wrong (and it will), you’ll just re-name your backup file, put it back where it was, and pretend it all never happened.

Now, here’s another common scenario. You want to create a new document – say, a new article — from an old one. In other words, you’re using one document as a template to create a new one. In this case you just save the old document under a new name immediately upon opening it.

So, I take myDocument.html and save it as myNewDocument.html before I make any changes. The original file remains intact in its old location. The new file has a unique name, so it won’t over-write anything when you put it on the server.

« »