Changing Directories - the CD Command

Let us suppose that there are two directories in the root—LETTERS and INCOME. You have been working on the files under the directory LETTERS and now wish to work on the files in the directory INCOME. This means that you would have to change from the Letters directory to the Income directory and make the latter the active directory.

DOS allows you to change your directory by issuing the CD command. The command to make the INCOME directory active is

C>CD\INCOME <Enter>

where CDstands for Change Directory.

The command for getting back to the root directory is

C>CD\ <Enter>

The command for going to the parent directory is

C>CD.. <Enter>

So, if you are in the subdirectory PERSONAL (refer Figure 1.6), then the above command will take you to its parent directory, iie. the root directory.

If you want to see the name of the directory in which you are working, the command you give is:

C>CD <Enter>

Just typing CD will display the name of the active directory.

For example, if you are currently in the Income directory and you give the command to display the directory name, the screen appears as under

C>CD
C:\INCOME
C>_

This indicates that you are in the INCOME directory under the root directory.

Removing a Directory - the RD Command

If the files in a subdirectory are not required or have been removed, it may no longer be necessary to retain the directory. The RD command can be used to remove such a directory.

To remove the directory WASTE on the C drive under the root directory, the command to be used is

C>RD C:\WASTE <Enter>

If the directory to be removed is not in the currently active drive, then the drive name must be specified. A path can be specified with the RD command. If a directory OLDSALES exists under the SALES directory on C drive and has to be removed, the following command can be issued:

C>RD C:\SALES\OLDSALES <Enter>

Whenever you use the RD command, remember that it can only be used to remove directories that are empty and are not currently active.

Displaying Path of a Directory - the TREE Command

The TREE command is used to display the path of each directory, subdirectory and files. The TREE command is used as follows:

TREE C: <Enter>

This command displays the directories on drive C with ail its subdirectories. Similarly, to view the path of each directory, subdirectory and files on Drive A, the command is:

TREE A: <Enter>

If you want to view all the subdirectories of the directory EXPENSES, the TREE command can be used as:

TREE EXPENSE <Enter>