File Naming Conventions
The importance of providing a consistent and readable name for files
As someone who works with a computer every day, the consistent naming of files and folders is something that the very organized part of my brain is very happy about. It is also one of the things that can drive a person to distraction if that organization is not being done. There are many reasons to follow a file naming convention when working with computers or the internet. The most important reason, in my opinion, is to keep files organized in a way so that others can quickly and easily understand the naming convention and follow it.
In case you didn't know, computers generally speaking are not smart. They can do amazing things, but they need to be told exactly what to do by programmers. Contrary to popular belief they cannot just fix things for you. They must be told what to do, how to organize, and can only really work within a restricted set of parameters. We won't get into a discussion about Artificial Intelligence or machine learning here because we are simply discussing how to keep our own files, or files we upload to our websites, organized.
We have had this conversation with some of our clients in the past when we've been asked to try to find specific files for either updating or deletion. People who are not overly familiar with computers assume that a filename that is created by an automated process (camera or phone), or by someone other than themselves cannot be modified. The truth is that any file can have its name changed, as long as the file extension is not changed.
For example, if I receive a file called "Design 45224 revision 6 Final.jpg" this may mean absolutely nothing to me. Once I take a look at the file and see that it is the final design for a header graphic, then I can rename the file to something that I will recognize, "website-header-background.jpg".
The same can be done for image files that are downloaded from a camera, or phone. An image from a camera that has a filename of "DCP_1344995673.jpg" doesn't tell me that this is a picture of my pet dog. Renaming the file to "scruffy-the-puppy.jpg" is going to be a lot easier to understand.
The proper naming of files is extremely important when it comes to a directory containing hundreds or even thousands of files. Without being able to see the contents of a file, an unrecognizable filename will require us to open or preview every file until we find the one we need. If a file is created using a naming convention that we as humans can recognize, we are able to use the power of a computer to find the file we are after very quickly.
We've used examples of image files so far, but naming conventions should also be applied to all file types. Descriptive filenames are not only easier to recognize by humans, Artificial Intelligence (I know I said I wouldn't discuss this) has been programmed to do pattern recognition of filenames. The big search engines have their bots scouring the internet for recognizable filenames. Using a search engine to find logos or images with specific search terms only really works well if the filenames have some form of proper naming. How often do you an image search on Google for "DCP_12345.jpg"? You don't. You search for "puppy images". The results will invariably have a large number of images that have the word puppy in their filename.
Here are some rules to follow when setting up a naming convention for your files, and these can be used for files that end up on the internet as well as for your own computer file system.
Filenaming Best Practices
- Naming consistency: when creating a naming convention files should be named in a consistent pattern. A prefix of the kind of file is useful, for instance img for images, doc for documents. The file extension will tell you the file type. Examples: img-scruffy-the-puppy.jpg, doc-scruffy-the-puppy-ownership.pdf
- Descriptive: descriptive names for files is important for both your own pattern recognition, and for when using your computer's search functionality. You may not remember the exact name of your document, but you may know a portion of the filename if you are using a naming convention. If you have a thousand images starting with DCP_, you can imagine the time wasting of trying to find one specific image.
- Special Characters: This is one of those things that seems like a good idea, but in reality it can cause no end of problems. Using an apostrophe for word contractions in a title, or an ampersand to reduce the length of a filename. Unfortunately many punctuation characters or symbols have specific uses in programming. Using these characters in your own file structures on your computer will not likely cause issues, however they will in all likelyhood cause major issues if they are uploaded to a website. These characters can prematurely stop a web page from rendering, or have other unintended consequences. Therefore it is important to limit which characters are used in your filenaming convention.
- Spaces: Spaces, again seem like a good idea. On your own personal computer they are unlikely to cause issues. On the internet however, a space isn't actually a space. Internet programming replaces a space in a filename with 3 characters. That space becomes %20. So a filename that is put up as scruffy the puppy.jpg will be rendered as scruffy%20the%20puppy.jpg. This may or may not cause problems, so it's better to be safe than sorry.
- Special Character Exceptions: There are two characters that can be used in filenames that should not cause issues. They are the hyphen and the underscore. If you need some spacing in your filenames, these characters can give you that legibility.
- If you are going to use dates as part of your filenames, it is best to use the ISO 8601 standard of YYYYMMDD (20220610).
- If you are going to have multiple versions of a file, it is best to include a version number. Example: img-scruffy-the-puppy-v1.jpg, img-scruffy-the-puppy-v2.jpg
- There are no restrictions on uppercase or lowercase letters, but filenaming should be consistent. Depending on how the computer interprets filenames, img-scruffy-the-puppy.jpg and Img-Scruff-The-Puppy.jpg could be considered the same file. Being consistent in how uppercase and lowercase are used will make this issue moot.
The above rules can also be applied to file directories (folders).
From a usability standpoint, by using proper naming conventions, a webmaster or website content editor will be able to find their documents or media files much easier and it will keep their website file library relatively tidy. For instance, we have seen the same image uploaded multiple times to a website because the webmaster could not find the original file they uploaded the first time because they didn't give the file a recognizable name, and therefore it was just easier to find it again on their computer and upload it again. As a result, the server file system ends up with several versions of the same file.
With site hosting costs based on file storage and bandwidth, the storage of extraneous files can really add up. An extreme example would be a directory containing 20GB+ of images and documents. When reviewing the directory that contained those files, there were a considerable number of duplicate files that likely could have been replaced with a single well named file and reused in multiple locations.
This may seem to be a lot of work to keep files organized, but in reality that organization of files can save time and money.