Remove Empty Directories in MS-DOS 6.22

This article explains how to remove empty directory structures from disk drives in MS-DOS 6.22 using the standard command line. It covers the specific command used for this operation, the required syntax, and the conditions that must be met before a directory can be successfully deleted from the drive.

In MS-DOS 6.22, the internal command used to remove empty directories is RMDIR, which can also be abbreviated as RD. Both commands function identically and are designed specifically to delete directory folders that no longer contain any files or subdirectories.

Syntax

The basic syntax for the command is:

RMDIR [drive:]path

or

RD [drive:]path
  • drive: specifies the drive letter containing the directory to delete (e.g., C:). If omitted, MS-DOS assumes the current active drive.
  • path specifies the directory's location and name.

Requirements for Deletion

For the RD or RMDIR command to successfully delete a directory in MS-DOS 6.22, the following conditions must be met:

  1. The directory must be completely empty: It cannot contain any user files or subdirectories. Hidden, system, or read-only files will prevent the directory from being removed. To verify that a directory contains no hidden files, run DIR /A inside the directory before attempting removal.
  2. It cannot be the current directory: You cannot delete the directory you are currently working in. If you are inside the target folder, you must change to a parent or different directory first using the CD .. command.
  3. It cannot be the root directory: The root directory (\) of any drive cannot be deleted.

Step-by-Step Example

To remove an empty folder named TEST located in the root of drive C:, execute the following commands:

C:\> CD \
C:\> RD C:\TEST

If the command succeeds, MS-DOS returns to the command prompt silently without an error message. If the directory contains any remaining files or attributes, the system displays the error message: Invalid path, not directory, or directory not empty.