Getting to Know DOS Directories

Computers are supposed to make life easier, not harder. Hard disk management is simply the way you use files on a hard drive. This concept involves some organization, and understanding that organization makes computing much easier.

What is a subdirectory?

A subdirectory is workspace on a disk. It's almost like a disk within a disk. You can copy files and programs into a subdirectory or workspace, and you can use DOS commands. The advantage to subdirectories is that you can store information in a subdirectory and keep it separate from other files on the same disk. That keeps the disk from getting file-messy.

Any disk can have subdirectories, though they're used primarily on hard drives to keep files separate and your programs organized. Rather than let you suffer through a hard drive with bazillions of files all in one place, subdirectories enable you to organize everything by placing information in separate areas.

  • Subdirectories could be called just directories. The prefix sub means "under," just as submarine means any large naval vessel a marine is standing on. All the workspaces on a disk are really directories. However, when you refer to one directory in relation to another, the term subdirectory is used.
  • A subdirectory is the same thing as a folder in Windows terminology.
  • All the directories on your disk create or are organized into what's called a tree structure.

The root directory

Every disk you use under DOS has one main directory, called the root directory. The root directory (often just called the root) exists on all DOS disks; it happens naturally, created when you first format the disk.

The symbol for the root directory is the single backslash (\). DOS uses this abbreviation — shorthand — in reference to the root directory. This symbol also plays an important role in the pathname, which is like a long filename.

Additional directories on a disk are subdirectories under the root directory. They branch off the root like branches of a tree. In fact, if you map out the directories on a disk and draw lines between each subdirectory, it looks like a family tree of sorts, as shown in Figure 1.


Figure 1: Subdirectories branch from the root, creating a family tree of sorts.
  • The FORMAT command is used to prepare disks for use under DOS. In the formatting process, FORMAT also creates the root directory.
  • Whenever you're using a disk, you're logged to, or currently using, a directory on that disk.

That funny <DIR> thing

To find a subdirectory on a disk, you use the DIR command. Directories are listed there, along with other files. The way you identify a directory name is by the <DIR> thing shown after its name (where other files would list their file size in bytes).

For example, consider this output from the DIR command:

Volume in drive C is DOS HAPPY
Volume Serial Number is 16CE-9B67
Directory of C:\
123 <DIR> 03-18-96 9:33p
COMM <DIR> 08-07-96 9:37p
DOS <DIR> 09-20-97 10:52p
GAMES <DIR> 09-22-97 5:18p
WP60 <DIR> 09-21-97 5:12p
AUTOEXEC BAT 574 09-05-97 10:04a
COMMAND COM 54,928 08-11-93 6:20a
CONFIG SYS 464 07-25-97 10:20a
WIN20 386 9,349 08-11-93 6:20a
9 file(s) 65,315 bytes
36,468,736 bytes free

The "files" 123, COMM, DOS, GAMES, and WP60 are actually directories on disk. At the top of the output in this example, Directory of C:\ tells you that you're looking at a directory of drive C (that's the C:), the root directory (shown by the backslash). The <DIR> entries in the listing are all subdirectories of the root directory.

  • Subdirectories appear in the DIR command's listing because they're part of your disk, just like files. In fact, directories are named just like files and can even have an extension like a file.
  • The C:\ is actually a pathname.
  • Commas in big numbers appear only if you have MS-DOS 6.2 or later. Early versions of DOS don't use commas, which is just DOS's attempt to overwhelm you with large values.
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com