DELTREE vs RMDIR Differences in MS-DOS 6.22
In MS-DOS 6.22, both DELTREE and RMDIR
(also abbreviated as RD) are used to delete directories,
but they function fundamentally differently in terms of execution, file
handling, and safety. While RMDIR is a conservative,
built-in command that only removes completely empty directories,
DELTREE is a powerful external utility designed to
recursively wipe out entire directory structures, including all nested
subdirectories and files, regardless of their file attributes.
Handling Non-Empty Directories
The primary functional difference between the two commands is how they handle directories containing data:
RMDIR(RD): In MS-DOS 6.22,RMDIRstrictly requires a directory to be completely empty before it can be deleted. If any files or subdirectories remain inside, the command fails and displays the error message:Attempt to remove directory has failedorDirectory not empty. (The recursive/Sswitch forRMDIRwas not introduced until Windows NT and Windows 95).DELTREE: This command automatically deletes a directory and every single file and subdirectory contained within it in a single operation. It traverses the entire folder hierarchy downward, eliminating the need to manually enter and empty each nested subfolder.
File Attribute Treatment
The two commands handle protected files differently:
RMDIR: BecauseRMDIRrequires an empty directory, users must first delete all files using theDELcommand. However,DELfails to erase files marked with Read-Only, Hidden, or System attributes unless their attributes are first stripped using theATTRIBcommand.DELTREE: It completely ignores the Read-Only, Hidden, and System attributes. It forcefully deletes protected files within the target structure without requiring the user to modify attributes beforehand.
Internal vs. External Commands
RMDIR: It is an internal command integrated directly intoCOMMAND.COM. It can be run from any prompt at any time, even if standard DOS path directories are inaccessible or missing.DELTREE: It is an external utility stored as an executable file (DELTREE.EXE, typically located in theC:\DOSdirectory). It requires access to the executable on disk or within the system'sPATHto function.
Safety Prompts and Confirmation
RMDIR: Because it cannot delete data,RMDIRexecutes instantly without asking for confirmation.DELTREE: Because of its destructive nature,DELTREEprompts the user for confirmation by default before wiping the directory tree:Delete directory "..." and all its subdirectories? [yn]. Users can bypass this prompt by adding the/Yparameter (e.g.,DELTREE /Y C:\TEMP).
Versatility with Files and Wildcards
While RMDIR can only target directory names,
DELTREE can also accept file names and wildcards. When
pointed at specific files, DELTREE acts as an enhanced
version of the DEL command, deleting matching files
immediately regardless of whether their Read-Only, Hidden, or System
attributes are enabled.