Classic Computer Magazine Archive COMPUTE! ISSUE 137 / JANUARY 1992 / PAGE 66

Learn to play the name game. (naming computer files) (Column)
by Tony Roberts

Judging by the questions I'm asked, file naming can be a difficult task. Computer users want to know: "How should I name my files?"

There's no pat answer to this question; it's partly personal preference, partly convention, and partly dictated by the software you use.

In the MS-DOS world, filenames consist of an eight-character root name plus a three-character extension. A period is used to separate the root from the extension.

The extension part of a filename often is used to indicate the type of file and may provide a clue as to which program created the file.

The extension EXE, COM, BAT, and SYS all indicate files that are used by DOS itself. Files ending with EXE or COM are executable or command files, and as far as you're concerned, there's no difference between them.

>From a programming standpoint, these files differ in the location of the program's data segment. Also, COM files can be no longer than 64K.

Graphics programs add various extensions to files to provide information about the type of graphics contained therein. You'll see files labeled with PCX, BMP, GIF, EPS, DRW, and TIF extensions. Each of these indicates a different way of encoding graphic data.

Spreadsheets typically add extensions of their own to files to indicate work sheets, charts, macros, and so on.

Today's software is getting better at accepting and working with data created by other applications. Page layout software, for example, usually can import graphics files from any number of sources and text files from a variety of word processors.

When naming files in your word processors, keep in mind the final destination of those files. If you're just writing and printing a few letters in WordPerfect, you can use any extension that suits you. But if you're writing a document you intend to import into PageMaker, you'll want to use a WP5 extension, which tells PageMaker how to decode and interpret your WordPerfect file.

Enough about extensions. What about the first eigth characters of the filename? This is a matter of personal, or perhaps company, choice. In any case, you'll find that adopting some uniform system for file naming will help you and your cohorts figure out of what's stored on your disks.

DOS is often criticized for its short filenames, but I wouldn't look for a change in filename length anytime soon. Here's how I make the best of the situation.

First, I invent client codes and project codes. I do a bit of work for Electrical South, which repairs circuit boards and electronic controllers. Every document I produce that relates to Electrical South, begins with the two-letter client code ES.

Taking this first step makes it easy for me to find all the files associated with Electrical South--no matter where they happen to the scattered across may hard disk. Using a file-find utility, I just search for ES*.*.

Running the search turns up such files as ESSKED.XLS, an Excel spreadsheet in which I set up a newsletter production schedule; ESBACKUP.SET, a PC Tools control file created when I last backed up all of my ES files; ESNL0891.PM4, a PageMaker document containing the "Electrical South Newsletter"for August 1991; ESBULL.EPS, an encapsulated PostScript file of a bull's eye that was used in the newsletter; ESRASH.XY3, a XyWrite document about Ken Rash (which also appeared in the newsletter); and ES0715.MEM, a memo to the Electrical South president (written on July 15).

I can remember what's in each of these files without having to open it up. I add date codes to my filenames especially when I create letters and memos and when I create issues of periodic projects such as newsletters.

I try to pack as much information as possible into every filename. The system work as long as you're willing to follow it, and it sure beats ending up with a disk full of files with names such as REPORT1.DOC, REPORT2.DOC, and REPORT3.DOC.

If your filenames include a numbering scheme such as chapter numbers or dates, here's another tip. For numbers less than 10, remember to add a leading 0 so your files will alphabetize properly in a directory.

Use CHAP05.TXT rather than CHAP5.TXT, or TR0925.LTR instead of TR925.LTR. If you fail to add the 0, your files will appear to be out of order in an alphabetized listing.

You'll find CHAP5.TXT sandwiched between CHAP49.TXT and CHAP50.TXT in your director. This occurs because the computer treats all characters in a filename as text and alphabetizes them accordingly. When you alphabetize, CHAP49 is placed before CHAP5.

With these simple file-naming tricks, you can by-pass DOS's file-length limitations and create an efficient file retrival system for your had drive.