Naming files

January 27, 2008

Earlier this month, someone on one of my technical writing lists suggested that an error they found was caused by having spaces in the file name. Here’s my slightly edited advice:

Avoiding spaces in file names is good practice.

While Windows machines and servers can deal with spaces, other operating systems/platforms can’t. If you’re producing HTML files for loading on to a server, especially an external server, you may have no control over the platform used on that server. Most of the *x varieties (Unix, linux, etc.) either don’t deal well with spaces, or treat them differently. Some of these platforms also treat upper case differently from lower case. So, “filename.htm” in Windows works the same whether it is “FileName.htm”, “FILENAME.htm”, “fILeNAme.htm” etc., but on these other platforms these are treated as separate files. Result: Seemingly erratic and inconsistent behaviour which has little to do with the application that created them but a lot to do with the platform where the final files live.

My recommendations for naming files so they work on all (most?) platforms are:

  • no spaces – use underscores instead (e.g. use “file_name.ext” not “file name.ext”)
  • no characters that might not be understood by platforms other than Windows
  • all lower case (e.g. “file_name.ext”, not “File_Name.ext”)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: