DOS file and directory maintenance Which single DOS command removes a directory and all of its contents (files and subdirectories) in one operation?

Difficulty: Easy

Correct Answer: DELTREE

Explanation:


Introduction / Context:
In DOS, deleting a directory tree recursively can be tedious if done file-by-file. DOS introduced a command to remove an entire directory and everything beneath it, simplifying cleanups and uninstalls.



Given Data / Assumptions:

  • The target is a directory possibly containing files and subdirectories.
  • User has appropriate permissions and no files are read-only or in use.
  • Standard DOS command set is available (DOS 6.x or similar).


Concept / Approach:

DELTREE performs recursive deletion from the specified path downward. It prompts for confirmation unless overridden by switches. This is distinct from DEL (which deletes files) and RD (which removes only empty directories).



Step-by-Step Solution:

At the prompt, type DELTREE path (for example, DELTREE C:\OLDAPP).Confirm the prompt to proceed with recursive removal.Wait for the command to remove files and subdirectories.Verify with DIR that the directory no longer exists.Optionally use switches to suppress prompts in scripts (use with caution).


Verification / Alternative check:

Attempting RD on a non-empty directory will fail, proving the necessity of a recursive command like DELTREE for bulk removal.



Why Other Options Are Wrong:

a: DEL . deletes files in the current directory only and not subdirectories.

b: RD (RMDIR) removes only empty directories.

d: CD changes the current directory; it does not delete anything.

e: Not applicable because DELTREE is correct.



Common Pitfalls:

Accidentally running DELTREE on the wrong path; always double-check the target and ensure backups exist.



Final Answer:

DELTREE

More Questions from Disk Operating System (DOS)

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion