(you can also find me on LinkedIn)

(also LinkedIn)

Are Your Filenames Too Long?

Do you have a complex folder structure? Do your subfolders have subfolders? Have you ever tried to copy a folder using Microsoft's "Copy" command only to find that the copy process crashes before it is finished (leaving you with no copy and a lot of wasted time)? Do know why it crashed and how to fix the problem?

For Microsoft users, long folder names are a product of the Windows operating environment. Prior to Windows, filenames consisted of an eight-character prefix, a dot (or period), and a three-character suffix.

With the advent of Windows, users could name files and folders in ways that really meant something. In fact, users could now get quite creative while naming files and folders (for instance, "Photos of Grandma and Grandpa when they went to the state fair in 1943").

Problem is, there is a limit to the length of those names -- and many users may be unaware of it. In general, filenames can be as long as 260 characters. That doesn't mean you can use all 260 characters in the filename, however. The maximum character limit has to take into account the "fully qualified pathname."

What is a "fully qualified pathname?" For a file located on your desktop, it starts with the drive letter, includes the name of the folder and all subfolders leading to the file, and ends with the filename. It also includes the colon (after the drive letter); all backslashes ("\") separating the drive, the folder, the subfolders, and the filename; and the dot (period) separating the filename prefix and suffix. Last but not least, a null terminating character is required for the computer to understand that it has reached the end of the fully qualified path string.

As you can see, a long pathname can contain quite a lot of baggage. This means you may have far fewer characters left for the filename than you think.

Understand, this does not mean that you can't have a 255 character filename located several folders deep in your folder structure. What is does mean is that much of that filename may be lost when Windows is required to use the fully qualified path name, and that name exceeds maximum limits.

This brings us back to our original example -- copying a folder with subfolders and files in a complex folder structure. To prevent the copy process from inexplicably crashing and wasting your time, you should consider using shorter filenames. Using our earlier example, you could name the file "Grandma & Grandpa - state fair 1943.jpg" (the jpg extension is just for example; your extension might be different). Thanks to the fact that you can use mixed case when naming files and folders in Windows, you can also eliminate spaces and create a name that is still easily readable (for instance, you could further abbreviate the filename as "Grandma&Grandpa-StateFair1943").

Existing files are another matter. You can look through all your folders and shorten the names of files and folders that appear too long (of course, this could take quite awhile). Another option is use a software application such as WinZip to compress the files. Unlike Windows, WinZip provides the user with an option to review a log file created during a compression process that fails. This allows you to determine which file caused the problem and fix it before re-running the compression process.

As a rule of thumb, consider keeping the length of names for files and folders to 50 characters or less (and preferrably less). That should allow you quite a bit of room for your complex folder structure.