MS-DOS 2.0 TREE-STRUCTURED DIRECTORIES One of the most powerful features of MS-DOS 2.0 is its ability to use multiple directories in a tree-like-structure. The Columbia 1600-4 hard drive is limited to 318 files in its main directory, but it can handle thousands of files in subdirectories in a hierarchical, or tree-like structure. The concept of a tree-structured directory is similar to that of a family tree. There is one "root" directory and all other directories are like "children," able to trace their lineage back to their "first ancestor" (the root directory). You can have as many "generations" of directories as you like, but you can only move about in this "family" tree structure in a direct path that goes from "parent to child" or "child to parent". A path may go from "root" to "parent" to "child", but it cannot go directly to "child" without passing through "parent". Each directory can contain program and data files as well as its descendant sub-directories. Below is an example of a typical tree-like directory structure. @BEGIN(VERBATIM) ROOT DIRECTORY ------------------------------ / | | \ PROGRAMS BIN LANGUAGES USERS ---------- --- --------- ----------- / | \ / | \ WRITER CALC FGRAPHS BOB SUE JOE ------ ---- ------- --- --- --- | | PRINTING TEXT -------- ---- Figure 1. Example Tree Structure @END(VERBATIM) Before loading numerous files on a hard disk it may be useful to plan a directory structure. Note the sub-directory named BIN in the example above. This type of directory is sometimes used to hold MS-DOS utilities so that the root directory contains only the names of its sub-directories and is not cluttered up with the many DOS files. MS-DOS provides commands to use this tree-like directory structure. They are: @BEGIN(VERBATIM) * MKDIR or MD - Make a new directory * CHDIR or CD - Change the default (present) directory * RMDIR or RD - Remove a directory * PATH - Layout a pathway to search through sub-directories for a file if it is not on the present directory * TREE - Display a listing of sub-directories * HUNT - Find the sub-directory location of a file @END(VERBATIM) When a hard drive system first boots up, regardless of the directory structure, it comes up in the boot (root) directory. To build a subdirectory (LANGUAGES, for example), type the command MKDIR LANGUAGES. You can copy files from the root directory into the subdirectory by typing COPY LANGUAGES. Move from the root directory to the subdirectory by typing CHDIR LANGUAGES. A DIR command from within a subdirectory will display the files in that subdirectory. From the root directory, DIR LANGUAGES will display the files in the subdirectory named LANGUAGES. The symbol "\" is known as the "path separator", and is used to separate the directories in a "path" from any file specified at the end of a path. The symbol "\" can also be used as the first item in a path to tell your system to start at the root directory and move down a path, instead of having to type all the directory names for a path that goes up the tree and back down again. As a general rule, the backslash symbol must be used whenever you are in a subdirectory and want to go to any other directory for a file, or when you are specifying a pathname. The MS-DOS 2.0 PATH command allows you to specify a "path" to be used in a search for a file. For example, if you type "PATH \LANGUAGE", MS-DOS 2.0 will first search the root directory, then the LANGUAGE directory for a file that it could not find in your present working directory. This predefined "path" will stay resident until you change it. You can see the defined "path" any time by typing PATH and pressing the Return key. If you are logged onto the A: drive and want to call BASIC from the LANGUAGES subdirectory on drive C:;, the drive name must be included in the PATH command: PATH C:\LANGUAGES Having defined the path (while still logged onto drive C:), you can switch to A: and call up BASIC by typing: C:BASICA This is very useful when you have a copy protected BASIC program on a floppy diskette, especially when there is not enough room on the floppy for the system files, the COMMAND.COM file and BASICA. After specifiying a path while logged onto C:, switching to A:, then calling BASIC, the BASIC prompt (OK) will be displayed on the screen. Load and run the program you need from Drive A:. @BEGIN(VERBATIM) The SUE sub-directory might look like this: Volume in drive C has label HARDDISK Directory of C:\USERS\SUE . 11-22-83 11:23a .. 11-22-83 11:23a TEXT 11-23-83 11:23a FILE1 EXE 16435 9-10-83 4:31p 4 File(s) 6457039 bytes free @END(VERBATIM) There is one file (FILE1.EXE) and one sub-directory (TEXT) in the SUE subdirectory. The "." entry in this sub-directory stands for the working directory (in this case, the SUE subdirectory), and the ".." entry stands for the "parent" directory (in this case, the USERS subdirectory). Both "." and ".." are present in all sub-directories. The entry ".." can be used as a shortcut in a "path" to move to the parent directory. Thus, to change to the USERS directory from the SUE directory, type "CHDIR ..". To get a directory of all the directories on the disk, type @B(DIR ..) from the root directory. All the files which do not have extensions will be displayed, and if they are directories, MS-DOS 2.0 reports it with a message beside the directory name. It is important to avoid confusing the path from root to subdirectory to file with the PATH command. The path between directories can be thought of as a pathWAY, while the PATH command is used primarily as a "roadmap" to let the MPC know which pathway to follow when looking for files. To help find your way around a complex directory structure, you will find the MS-DOS 2.0 TREE command useful. It lists all the directories on the disk and their sub-directories. The HUNT command will show you the sub-directory location of a file. "Getting around" in MS-DOS's tree structured directory may seem complicated at first. But as you use directories, you will grow accustomed to them, and you will appreciate the ability to organize and structure your files. The audio tutor cassette tape will guide you through a few practice exercises in using the structured directories, and the MS-DOS Reference Manual contains a detailed explanation of the directory structure in chapter 4 and a description of the commands that relate to it in chapter 5.