What’s in a filename?

Filenames. Those magical labels we give our documents, our pictures, or other various creations. All filenames consist of two parts: Name.Extension where the Name part is the visible on all computer systems and the .Extension part is sometimes hidden from view. I personally hate computer systems that hide the extension because it allows phishing scammers an easy means to infect a computer by asking the victim to open up a picture called “aVirusPicture.jpg” and people will do so since they know .jpg is just a picture extension… not realizing that the full filename is “aVirusPicture.jpg.exe” because the Operating System has hidden the last “.exe” on them.

Most file contents are just 1’s and 0’s on the hard drive and you cannot tell what they represent. It could be a picture, a song, a document, or thousands of other things. The name of the file has nothing to do with what is inside your file. You can try to open files up with any software, really. Want to see if that photo of grandma will play as an mp3 file? Open up your favorite player and try to open up the photo to play as see! You could even rename the photo and give it an .mp3 extension and try to open the file that way. It won’t play, but there’s nothing that says you cannot try. That’s all a file extension is anyway, a hint as to what the file content might be.

Extensions are just a traditional way for a computer system to guess at what is inside a file and start the correct program for you to read or edit it. Renaming files with different extensions tricks the computer into opening different programs to read your file. If you renamed your “grandma.jpg” picture to “somefile.zip” and tried to open it, a ZIP program would launch and try to read it as a .zip file. Similar to renaming it with .mp3, it will try to open it as a song. Filenames can contain any number of “.”s, but only the last one is considered the file’s extension. So if you named a file “somefile.mp3.jpg.exe.zip.tar.doc.mp4” and then tried to open it, the computer would think that the file is an .mp4 video file.

If programs try to force you to use a specific extension, you are still free to change it at a later time with a file browser. You’ll just have to change it back if you want to use that program again to load that file. Other times, systems will prevent you from trying to get a file past their filters for some reason; they do this by checking the file’s extension. So if you change the file’s extension, you can safely get it past the filters and then rename it back to it’s original once it’s on the other side. Most filters of this kind are put in place to prevent spam as well as phishing emails, but they also get in the way of conducting legitimate business sometimes. It’s easier to work within the system than trying to get exceptions put in place. =)

No real reason for this post other than to pontificate on filenames and how easy it is to change them and make the computer think a file contains bits for something completely unrelated.

Leave a Reply

Your email address will not be published. Required fields are marked *