Skip to main content

Making, Changing, and Removing Directories

You used the DIR (directory) command in Section 3 to display a list of filenames on the screen. You can create and name multiple disk directories on a disk to allow for the subdivision of your files. This feature lets you group common files into separate directories. This is similar to subdividing information into file cabinet drawers and file folders. This is particularly convenient when you use a fixed disk containing hundreds or even thousands of files. Instead of listing all
files in one directory, you can list files in smaller, more manageable sub directories. Lock at the following directory commands.

Command                                      Purpose
                  MKDIR or MD                                Make a new directory
                  CHDIR or CD                                Change to another directory 
                  RMDIR or RD                                Remove (or delete) a directory from the disk

Each sub directory is assigned a unique path name. Therefore, you might create a word processing path name, a database manager path name, a spreadsheet path name, and so on.

Sub directories Imagine your directory structure in the shape of an inverted tree. There is a main directory (the root) and sub directories (the branches). This relationship is often referred to as parent and children directories. The following illustration shows a typical directory structure.


Notice that the Bill directory has two sub directories. Therefore, Bill is a parent to LilBill and WmJr. Both Lil Bill and WmJr can also have sub directories, or children, as required. Once directories are created with the MKDIR (or MD) command, you can move in and out of the
directories with the CHDIR (or CD) command. You can remove directories with the RMDIR (or RD) command. These three commands are described in the following paragraphs.

The MKDIR Command: The MKDIR (or MD) command is used to make (or create) a new sub directory that is subordinate to the currently logged directory. To make a sub directory having the pathname WP (for word processing), log your root directory, type MKDIR WP, and press
Enter. You may prefer the short form of this command, which is MD. If you lisi a directory of the disk containing your new WP sub directory, the sub directory listing is displayed:
                                      W? <DIR> 6-07-83 11:25p

The CHDIR Command: The CHDIR (or CD) command is used to change from one directory to another. If you are in the root directory and wish to move down to the BILL directory, type CD BILL and press Enter.

To move to WMJR (one level down), use CD WMIR O: CD\BILL\WMJR and Enter. To move back up to the parent (one directory level up), type CD .. and press Enter. To move to tie root
directory from any logged sub directory; use CD. You can move directly to any directory (or file path) from another by including the complete path name in your CD command. For example, the command CD\BILLI\WMJR takes you directly to the C:\BILL\WMIR file path
from any logged location.

The RMDIR Command The RMDIR (or RD) command is used to
remove a sub directory. First you must delete all files within a
sub directory before it can be deleted. If necessary, you can copy the
files you want to retain to another directory with the COPY command.
Then delete all files from the sub directory you want to remove. To
remove an empty sub directory having the path name WP, go to the
directory immediately above the one to be removed, type RD WP, and
press Enter.

The following two lines are common to a sub directory display.
                  .                        <DIR>            1-01-91         1:44a
                      ..                       <DIR>            1-01-91         1:44a

                                             2 File(s)                        28560 bytes free


The single dot represents the directory being listed, while the double dot indicates the parent directory. With some versions of DOS, you can list the parent directory by typing DIR .. and pressing Enter. You can list the local directory by typing DIR. and pressing Enter, although the
period (.) is superfluous. Regardless of the currently logged directory, you can view the files in
another sub directory by using a command like DIR BILL\WMJR. Notice that the backslash tells DOS that the entry is a directory name rather than a filename.


Comments

Popular posts from this blog

Filenames

It is important to understand DOS file naming conventions and their use. Here, filenames and some special filename "tools" called wild cards and literals are described. What is a File name?   Every program and data file is given a name to differentiate it from other programs and data files. A program is one or more computer instructions collected into a file. A data file is normally a collection of characters (or data) that make up a document, like a letter, or a database, like a collection of accounting transactions or customer records. Descriptive filenames are normally used. For example, if you create and save a letter to Mom, you might give it the filename MOM.LTR. A letter to Dad could be called DAD.LTR. A word processing program file might have the filename WP.COM. Examine these filenames a little closer. First, notice that each filename is meaningful. This is important if you want to know what is in a file by looking at its name. Obscure filenames are of little u

What Is DOS?

What is DOS? Your disk operating system (DOS) performs a number of essential jobs. These includes: Controlling the way various application programs, such as word processors, electronic worksheets, database managers, accounting programs, etc., operate with your computer. DOS creates an environment that lets these programs "talks" to your computer and its input and output devices (printers, modems, display screen, keyboard, disk drivers, etc.). Keyboard and program-generated information is read, interpreted by DOS, and transferred to the selected computer device. Data being returned by your computer device. Data being returned by your computer is again translated by DOS into useful information and written to an output device, such as your display screen, printer, or disk. Providing "housekeeping" and file management utilities that perform useful tasks such as: Disk preparation (formatting, copying, etc.) File operation (creating, displaying, copying, combining, renami