File types and extension

To a computer, all data is just bits. It has no way of looking at a series of bits and just knowing what sort of data it is. So that picture of Aunt Lulu is completely indistinguishable from your web browser. That's actually a great feature but it has some drawbacks, the most annoying one being that when you double click on a file the computer can't know with 100% certainty what to do with that file. Instead, programmers have come up with some clever ideas to tell the computer what type of file it is.

Macintosh computers use what is known as a "resource fork". It's basically a hidden part of a file that contains "metadata", or data about your data. In that metadata are two special numbers that tells the computer which program created it and what exactly it is. The picture of Aunt Lulu might have a number 15:93 (I made those up) meaning that it was created in Adobe Photoshop and is a JPEG image.

That method works great if you always use the Macintosh and never send the file over the internet. Since the resource fork isn't part of the file, it won't be included with the file when you email it. And if a non-Mac computer ever gets ahold of the file, well kiss your nifty number goodbye.

What do Windows computers do instead? They use file extensions. Every file gets a 3 letter extension that describes it's contents. With the advent of long file names in Windows 95 the restriction on 3 letters has technically been relaxed, but it's still pretty common. How about an example? Well, all right.

Back to Aunt Lulu (I hope she doesn't mind), her picture would probably be named "auntlulu.jpg" or possibly "Aunt Lulu.jpeg", or some other variation. See the ".jpg" bit of the file? That's the file extension. It's denoted with a period. Other common ones are TXT for plain text, HTM or HTML for web content, DOC for Word files, XLS for Excel spreadsheets, PDF for Adobe's great document format, and EXE for executables.

How could that ever cause problems? I'm glad you asked, because it certainly does. A lot.

Microsoft decided that file extensions tend to confuse people. The often forget the extension and the computer can't tell what sort of file it is. They decided to hide the file extensions by default and just show a pretty icon.

That solved some of the problems, but then people didn't learn about file extension and other took advantage of it. Viruses and worms started going around masquerading as images. People would see a file named "Ana Kornikova.jpg" and figure it was a picture of her. Trouble was the file was really "Ana Kornikova.jpg.vbs". Ever heard of a VBS file? It's a program written in Visual Basic. This particular one did nasty things.

So first thing you want to do if you are using Windows is to enable file extensions. Open up My Computer, go to the Tools menu and select Options. Find the one named "Hide extensions for known file types" and unselect it. There. Now you'll see all those files for what they really are.

tags: 

1 Comment

This article

I liked it. I'd like to read more!

Subscribe to Comments for "File types and extension" Subscribe to zmonkey.org - All comments