What's in a File Name?
Actually, there’s a lot. We want to be organized, and we want descriptions that make sense and allow us to choose the right file to open, send, review, edit, forward, or otherwise use. Recently in IT@Sam, we’ve seen a number of issues with errors that can be attributed to too-long file names and paths. So, what really is in a file name and, more importantly, the path?
For the more tech-savvy readers, “the path to a specified file consists of one or more components, separated by a special character (a backslash), with each component usually being a directory name or file name, but with some notable exceptions…Each component of a path will also be constrained by the maximum length specified for a particular file system. In general, these rules fall into two categories: short and long. Note that directory names are stored by the file system as a special type of file, but naming rules for files also apply to directory names. To summarize, a path is simply the string representation of the hierarchy between all of the directories that exist for a particular file or directory name.” - Naming Files, Paths, and Namespaces
For those who prefer to read in English: Sometimes we create file names, which make sense and are highly descriptive. But, when that is incorporated as part of the file’s full path (which isn’t always visible), the entire name may be too long. There is only so much space in which this information (the file path) can be stored. And when we overload that space, we get errors when trying to take actions with those files. Creating layers and layers of folders, while seemingly helpful, can actually create a sort-of house of cards of file names.
The technical bottom line, in English, is that the maximum safe length of a file path should be less than 260 characters. That’s not very much when you consider that some of the information is typically “hidden” from what we usually use. So, what’s best practice? Here are a few tips:
- Be organized, but be brief. Use short folder names.
- Collapse your organizational/hierarchical structure to be more flat than deep. Example: fewer layers, but possibly with more folders or files in each layer.
- Collapse dates, if you must use them. Example: For February 3, 2014, use “20140203” instead of “2014-02-03.” (You only saved 2 characters, but you should be able to find different versions faster!)
- Use abbreviations that are universal or make sense. Example: Use “dept” instead of “department.” (You just saved 6 more characters!)
- Remove spaces. Example: Instead of “FY15 Budget Presentation for Client Services” use “FY15ClientSvcsBudgetPres.” (You just saved a whopping 20 characters!)
And here’s a “full” example, which reduces one layer of folders, all the extra spaces, and some of the extraneous letters:
- Instead of: 2013_Information Technology\Policy to Review\Security Policy IT-01\Review by 02-10-2013
- Try this: 2013_IT Policy Reviews\SecurityIT-01\RevBy021013
And our “tip” or “best practice” that we all say we need to do but usually don’t dedicate time to: clean out your files regularly!