Directories and files
The concepts of directories and files are so intertwined that you may need to read about one before you understand the other. I have chosen to start with directories. I am assuming, for the sake of simplification, that you have only two disk drives: A: (the diskette drive) and C: (the hard disk) and that you have no other logical drives on your hard disk. Logical drives are explained below.
Later, I shall be giving you a short description of how a hard disk is built up. In the meantime: Directory means signpost, that which directs. Just as most of us live at an address, so that the postman and others can find us, we can say that a file also has an address on the hard disk ? or on other media like a floppy disk. The "needle" (read head) of the hard disk has to find the file, especially the physical place where the file starts.
Imagine there is a wide highway, crossing the whole country. This corresponds to what is called the "first" or root directory. Every side road off that main highway corresponds to a sub-directory. Every side road off each individual side road corresponds to sub-directories to the first sub-directory, and so on. We live along these roads, and we all live at a house number.
The left of the diagram shows the root and some of my sub-directories. I have five sub-directories under Windows, some of which have no sub-directories.
Let us choose the file C:\CONFIG.SYS. The file's address is specified by a name, which is made up of the following components:
C: designates the logical drive; the colon helps to identify it as something special and not the name, for example, of a file. DOS uses the concept of logical drives. Other logical drive designations D, E, F, and so on correspond to other "countries." The historical reason is as follows: the first PC design was diskless, the next had one disk drive, the next had two, the next had a hard disk fitted and so on. A: is the first floppy disk drive, B: the second, C: the first logical drive on the first hard disk, D: is either the next on the first hard disk or the first logical drive on the second hard disk and so on.
\ is called a backslash and denotes the start of a (sub-) directory.
CONFIG is the file's name.
SYS is the file's extension.
When you first got your PC, you - or the programs you installed (e.g. WordPerfect) - began by creating new directories. For instance, C:\DOS and maybe C:\WP or C:\WP51. These are sub-directories (side roads) off the root directory. They are where DOS program files and WP program files live. WordPerfect's chief file, the main program, is - to give it its full name and address - C:\WP51\WP.EXE.
When you type WP, or start the program any other way, this file is activated. Again, the full name is a drive (a letter followed by a colon) plus a sub-directory plus a file name and extension.
Notice the rather irritating backslash \, which is used as, and called, a separator. The ASCII value is 92.
Why is it that you should divide your hard disk into all these directories? To make it easier to find and manipulate different programs and files. It is very practical to have all the files that belong to WP in one directory, perhaps with some attached sub-directories. There they all are if later you want to move, copy or delete the whole program.
When you want to start a program, you have to point DOS in the right direction by stating which directory and which file. At the prompt, you can move to the relevant directory by using one or more change directory (cd) commands, e.g.
and then start WP by entering
WP starts because the file WP.EXE is in the default directory, which here is C:\WP51.
Now if you want DOS to look in directories other than the default directory when you start a program, you can define a special path (collection of directory names) that DOS will remember. If in any directory you type
then on the command
DOS will look first in the root directory (C:) for WP.COM, then for WP.EXE, then for WP.BAT, and finding none of them here it will look in the first section of the path (C:\DOS), then the next (C:\WP51). A semicolon separates the different directories.
If you have problems starting a program, e.g. you receive the message Bad command or file name, the cause could be that your path doesn't contain the directory in which you have the program. Check your AUTOEXEC.BAT. Tt normally specifies the path command.
When you save your first document, you should notice what the default directory is. In other words, where is the computer placing your documents? If you don't keep an eye on this you'll find it hard - at least in the beginning - to find them again.
A directory is a storage area containing files. Every disk (whether diskette or hard disk) has what is called a FAT (File Allocation Table). It keeps track of the physical location of directories and files on the disk and is obviously an extremely important element because without it, DOS cannot keep track of data.
Every time you create, save, copy, delete or do anything with one or more files, the FAT is updated. Therefore if you delete 50 files in a directory it takes some time to update this table, which is essential on a PC. In fact there are two FATs and if one of them becomes unreadable, DOS tries to repair it by referring to the other. Luckily this doesn't happen often but it can. This is one reason that it is important to make back-ups.
When we work with files using a program that is written specially to manipulate files (like Dosshell, Norton Commander, PCTools or Windows File Manager), we usually see a stylized graphic picture of the logical structure: the arrangement of directories and files on the hard disk.
The "main highway," the root, comes first with all its sub-directories. As we have seen, every one of these sub-directories can have its own sub-directories, and usually there is one file or more in every directory. Nearly all programs show this logical arrangement - actually a picture of the FAT - in a form known as a directory tree.
The root directory (C:\) should contain as few files as possible in order to keep your PC lean, mean and fast. Preferably only the two startup files plus COMMAND.COM - here I am not considering the "hidden files" that are part of the operating system. Unfortunately certain programs place one of more of their files in the root directory.
If on inspection you find you have a lot of files, find out if you really need them in C:\ and, if not, delete them or move them to the relevant directory.
It is of fundamental importance that you manage your files well, store them in obvious places and know where to find them. You can do much of this at DOS level or in some applications, e.g. WordPerfect, but personally I use and prefer the file management program Norton Commander, which I discuss on page *.
In a computer context, the word file refers to a specific collection of data. The data may make up part of a computer program (or a whole program) or a company report or a letter to your grandmother or the latest edition of your school newsletter. In the old days (and to some extent it is still the practice), letters and reports were stored in hanging folders in a filing cabinet. You can think of each hanging folder as a directory that contains files.
DOS, the operating system, consists of many different files, each of which performs its own special purpose so that other programs, for instance a word processor, can work. If you write DIR at any DOS prompt, the screen will show you the names of all the files in the directory plus their sizes, creation dates and so on.
Your word-processing program also consists of a collection of files, each of which executes a function. When you install modern programmes they often ask you in which directory you will place the program's different files, and they usually make their own suggestions, e.g. C:\WP51 for WordPerfect 5.1. I-ve chosen WP as an example because it is so widely used.
Different types of files
There are two basic types of files: those that form part of a program, and those that contain data that you and your program created. WP.EXE is part of WordPerfect but a letter to the tax authorities is called a document or data.
If you create a directory listing (DIR) or look at the file names using Dosshell, Norton Commander or a similar program, you will see that they have different extensions.
An extension of COM or EXE indicates a program file. COM files can have a maximum size of 64 KB, while an EXE file can be larger.
CONFIG.SYS contains calls for many different device drivers, which usually, but unfortunately not always, have the extension SYS. Other "driver files" can carry the extension DRV, typically in Windows. Batch files, which I will describe later, must have the "surname/last name" You can start BAT. COM, EXE and BAT files simply by typing the name of the program (file) at the prompt.
Data files (letters, reports, shopping lists, and so on) are nearly always given an extension automatically by the program that produces them. In the following paragraphs, I will discuss what are known as straightforward text files, i.e. files that contain only text with no formatting codes (bold, underline, etc.).
Documents from word processors are often given the extension DOC by default. Traditionally, text files are given the extension TXT or ASC. A text file has been stripped of all the various codes that a word processor normally includes to show where the margins are, whether letters are bold, in columns and so on. Other names are ASCII files or WordPerfect's peculiar expression DOS files.
You can use an editor (a mini word processor) to write or change a text file. Microsoft now includes an adequate one called EDIT with MS-DOS.
The good thing about standardized extensions is that you can quickly see what kind of file it is. Fortunately, everyone seems to agree on the same standard. More and more programs have text files included with them that are read by the main program when it starts up, and are used to configure the program or set up default values and other settings, so that the program runs in a particular way.
Windows with its text files WIN.INI, SYSTEM.INI and SETUP.INF is the best known, and most difficult, program in this regard. But generally more and more programs have an INI (initialize, beginning or startup) file - which is read when the program is loaded.
CONFIG.SYS and AUTOEXEC.BAT are in effect DOS's initializing files. Goodness knows how many millions of people have spent how many millions of hours over the years typing these strange file names!
If I am laboring this point somewhat, it is because PCs and their programs are becoming increasingly complex. Text files containing important information about the way a program works are often altered by other programs. It is important to be able to look at and amend these files.