Part I, File Management Barry Gordon New York Personal Computer, Inc. This article is about organizing files on any hard disk attached to a member of the IBM PC family, including the PC with an Expansion Unit, and certainly, the PC AT. The following suggestions have evolved from several months of using the IBM PC XT as a follow-on system to the IBM PC. I hope these thoughts prove useful to those who work with hard disks on the IBM PC, particularly those who are new to it. File Management The hard disk is not merely an overgrown diskette. It can be used that way, but you would be inviting serious file management problems in doing so. The hard disk has other capabilities you should utilize, and there is no reason not to take full advantage of the hard disk's potential. About the last thing you want to deal with is a ten megabyte hard disk containing all its files in one directory. (There is a limit of how many files the root directory can contain, so the disk may give you an error message even though much of the disk is not filled.) With intelligent organization, the hard disk retains its speed advantage over the diskette, and you are better able to keep track of your files as well. The name of each file should use filename and the three-letter extension. Sooner or later you will need all the help you can get in remembering what each file contains. Most importantly, though, your files should be organized among several directories. The Root Directory Each DOS volume (diskette or hard disk) has a root directory which DOS creates when it formats the disk. The root directory on your hard disk should contain a minimum of files, reserving the space for sub-directory names. Nonetheless, a few files are essential in the root directory. When you format the hard disk, use the /S parameter: FORMAT C:/S which copies three .COM files to your hard disk: (IBMBIO.COM) (IBMDOS.COM) COMMAND.COM Notice that the first two are hidden files. You won't see them in any DIRectory listing, but the CHKDSK command will tell you they are there. You should store the various DOS external command files and all data files in other sub-directories. Sub-directories for Executable Files Now let's consider locating your various executable program files--the .EXE, .COM, and .BAT files. You'll want to separate related programs into sub-directories of their own. For example, you may want one sub-directory containing all of the external DOS commands, another sub-directory with your word processing .COM and .EXE files, another with your accounting .COM and .EXE files, etc. until you have stored all of your executable programs into sub-directories. They are much easier to remember this way. The root directory has no user-assigned name, but all sub- directories are specifically created and named using the MKDIR command, MD for short: MD anyname You can create as many levels of sub-directories as you like, but generally, the fewer levels you have to create, the simpler your directory structure will be. There will be times when a second- or third-level sub-directory is needed (a directory created within another sub-directory), but multi-leveled sub-directories create a more complex path structure for both you and DOS to sort through. Directory Sizes You can fill a sub-directory with as many bytes as the disk will allow, but it is often convenient to limit the size of those sub- directories into which you regularly store data to the capacity of a single diskette, 320-360 KB. This allows you to back up a directory using the COPY command: COPY C:*.* A: The COPYable directory size offers an alternative to the BACKUP and RESTORE commands, an alternative that many find easier to use. It offers portability as well as backup. If you want to verify the copy with its original, you can follow the COPY command with this: COMP C: A: However, if you feel confident using the BACKUP and RESTORE commands, the contents of a single sub-directory can be as many bytes as you like. The bigger it is, the more time consuming the backup process becomes. Another suggestion is to give each backup diskette a volume label. This is especially useful if you use the COPY command to back up your sub-directories. By using the /V parameter when you format the diskette, you can label your diskette with the same name as the directory it backs up. It is rarely necessary to back up the entire hard disk. Typically, you store data changes in the files of a few sub- directories, those few being the only sub-directories you need to back up regularly. Many sub-directories never change, and need backing up only once. Part II, DOS BATch Files Barry Gordon New York Personal Computer, Inc. DOS and BATch Files Familiarity with DOS is assumed. However, it is helpful to the new user to include a paragraph or two on BATch files. The IBM PC and DOS work with three different kinds of program or command files: .EXE, .COM, and .BAT files. (BASIC and BASICA work with their own .BAS files, but those are not relevant to the present discussion.) The .EXE and .COM files give instructions to the PC itself. They are produced by assemblers, compilers, and linkers. The .BAT or BATch files are instructions to DOS which you create for your own convenience. I will discuss a couple of commands that you may find convenient in working on your PC: the DOS PROMPT command and the PATH command. The DOS PROMPT Command Just as DOS keeps track of a default disk drive, it will also keep track of each drive's current directory (the directory you are working in). Most often, this directory is the one you tell DOS to assume and use when no other is specified. The DOS prompt always has indicated the default disk drive followed by the greater-than symbol: A> which works well for diskette drives. With a hard disk, you will want to know the directory you are working in (the current directory) as well. You can customize the prompt to show the current directory using the DOS PROMPT command. The command PROMPT $P$G tells DOS to display the name of the current directory whenever the prompt appears on your screen. Other, more elaborate, prompt variations are possible, but $P$G is a useful beginning. The DOS PATH Command The actual program fetching is accomplished by means of the DOS PATH command. This command tells DOS where to look for your programs (the executable files) when they are not in the current directory. The overall scheme begins to take shape: you work in the (current) directory containing your data files, and DOS looks for the programs you need (in priority sequence) in other sub- directories. Thus, your PATH command might look something like this: PATH C:\anyname1;C:\anyname2;C:\any3 The PATH command should contain the full specification of each sub-directory, including the drive designation. This keeps the search path valid even if you should decide to make, say, drive A: the default drive temporarily. Since the root directory is not named, it is not included in the PATH command. Of course, having to enter all of this PROMPT and PATH information each time you turn on your PC can become a nuisance. The proper way to handle this is to create special BATch files in the root directory that store and execute your commands. Creating BATch Files The most direct way to create .BAT files is to use the DOS ability to COPY a file directly from the PC keyboard into a disk file: COPY CON filename.BAT where CON is the DOS name for the keyboard, and "filename" represents the name you wish to give your new BATch file. You enter your file contents, line by line, ending with a line containing ^Z (Control-Z), which can be entered by pressing the Function Key 6 (F6). As an alternative (though I don't recommend it) you could learn to use EDLIN, a minimal file editor, whose chief virtue is its automatic inclusion with the DOS package. For serious work of this kind, a good file editor is a great help. The IBM Personal Editor is one of the very best. The AUTOEXEC and SETPATH BATch Files The AUTOEXEC.BAT file is executed only at startup (unless you specifically enter it), and contains those commands you wish to enter for your convenience in operating your PC. A simple version of an AUTOEXEC.BAT file might look like this: DATE TIME PROMPT $P$G PATH C:\anyname1;C:\anyname2;C:\any3 The first thing you may want to do is to move the PATH command from the AUTOEXEC.BAT file and put it in its own BATch file called SETPATH.BAT. The AUTOEXEC.BAT would have these four lines: DATE TIME PROMPT $P$G SETPATH Your SETPATH.BAT file would look like this: PATH C:\anyname1;C:\anyname2;C:\any3 Putting the PATH command in the SETPATH.BAT file lets you modify your program search path any time you wish, and then restore it by getting into the root directory and entering the SETPATH command. Taking Advantage of Your PC's Hard Disk: Part III, CONFIG.SYS and the Virtual Disk Barry Gordon New York Personal Computer, Inc. There are some simple things you can do to enhance the performance of your hard drive. Creating a CONFIG.SYS file and a virtual disk can give you added power and speed in working on your PC by reconfiguring your operating system and Random Access Memory (RAM). The CONFIG.SYS File Another file that is useful in the root directory is the CONFIG.SYS file. It's a collection of miscellany to modify the way the PC system works. You may want to try a CONFIG.SYS file consisting of three lines: BREAK=ON FILES=16 BUFFERS=8 The BREAK command allows you to interrupt the system more easily should you wish to terminate the execution of a program. The FILES command allows DOS to juggle more than the default of eight active files simultaneously. This is important, because DOS loads five files of its own, leaving you with only three. Sixteen should give you enough to handle most any situation. The BUFFERS command can speed up certain kinds of disk operations. You may want to try as many as 16 or even 32 for a 20MB hard disk. The Virtual Disk A large internal RAM not only allows manipulation of larger files when necessary, but gives the user access to the speed of internal memory for processing data. Just as the hard disk increases computing speed over the diskette drive, so internal memory, if utilized, increases computing speed over the hard drive. To tap the speed and power of the internal memory, you might consider setting up a virtual disk. However, to attempt to set up a virtual disk, you should have more than 256KB of memory in your PC, preferably, 512KB or larger. The virtual disk is a portion of RAM set aside to simulate a disk. The virtual disk is referred to by the drive designation letter following that of the system's last hard disk. Assuming a single hard disk C:, our virtual disk becomes D:. The virtual disk is created at startup by a program such as the VDISK command that comes with DOS 3.0., working together with a command you save in your CONFIG.SYS file. With 512KB of RAM, a reasonable virtual disk size to try is 64KB. If you have a 640KB system, you may want to set up a virtual disk of 192KB. I suggest leaving about 448KB of available, active RAM to have ample memory for DOS to do its work. A virtual disk of even 64KB can do wonders. It can also be effectively larger by specifying the smallest possible sector size -- e.g., 128 bytes -- for the greatest possible data packing density. Assuming VDISK.COM and 640KB of RAM, the virtual disk specification in your CONFIG.SYS might look like this: DEVICE=C:\VDISK The entire CONFIG.SYS file would look like this: BREAK=ON FILES=16 BUFFERS=8 DEVICE=C:\VDISK.SYS 192 128 64 The SETPATH.BAT and AUTOEXEC.BAT Files Revised What do you do with this virtual disk D: now that it is set up? First, you can begin to take full advantage of your virtual disk's speed by adding a statement to AUTOEXEC.BAT to transfer the sub-directory of your most-used files to the virtual disk D:. Your AUTOEXEC.BAT file now contains the following: DATE TIME PROMPT $P$G COPY \anyname1\*.* D: D:SETPATH Note that the SETPATH command must remain the last one in the file. Next, modify the PATH command (in SETPATH.BAT) to PATH D:\;C:\anyname2;C:\any3;C:\any4 replacing the c:\anyname1 you formerly had in SETPATH.BAT with the root directory of your virtual drive D:\. (Again, note that you specify complete paths, including all drive designations, to keep the command totally independent of what the default drive might happen to be.) Finally, move the SETPATH.BAT file out of the root directory and into the \anyname1 directory for automatic transfer to D:. This allows you to execute the SETPATH command from any directory, entering it as simply SETPATH or D:SETPATH if necessary. The root directory on your hard drive now contains the following files: COMMAND.COM AUTOEXEC.BAT Sub-directory Names CONFIG.SYS VDISK.COM (or equivalent) Tips Concerning The Virtual Drive Now that your PC has the virtual disk D:, you will want to keep only your most-used files in your C:\anyname1 directory. I would suggest you put in some DOS external command files, plus regulars like BASIC.COM, or perhaps a few of your personal favorites, such as PE.EXE or your word processing program. Depending on the size of your virtual disk, you might even wish to add some non- executable, but nonetheless frequently used, files that you would like to have accessible from any sub-directory. All of these would presumably reside permanently in your C:\anyname1 directory so that they transfer automatically to D: at system startup. The one thing you must not forget is that your virtual disk D: actually resides in RAM and not on a real disk drive. I suggest you do not store anything in your virtual drive that is not stored in a file on your hard disk or on a diskette, because whenever you turn your PC off or whenever the power fails, everything in your virtual disk is cleared. Summary That's it. My experience shows that a hard disk with large internal RAM, set up more or less as recommended here, can be a real pleasure to operate. A brief summary of what the various files might look like is given below: The Root Directory COMMAND.COM AUTOEXEC.BAT Sub-directory Names CONFIG.SYS VDISK.COM (or equivalent) CONFIG.SYS File BREAK=ON FILES=16 BUFFERS=8 DEVICE=C:\VDISK.SYS 192 128 64 The numercial values in the DEVICE command will vary depending on the size you wish your virtual disk to be. AUTOEXEC.BAT File DATE TIME COPY C:\anyname 1\*.* D: PROMPT $P$G D:SETPATH The D: shown above presumes that you don't have a second hard disk attached to your PC. With two hard disks, the virtual disk would be E:. C:\anyname1 (Directory) SETPATH.BAT Most Frequently used Executable Files High Usage Reference/Data Files SETPATH.BAT File PATH D:\;C:\any1;C:\any2\;C:any3;... C:\anyname 2 et al (Directories) Other Executable Files by Frequency of Use Other Data Files Grouped by Related Functions