MS-DOS 6.22 DELTREE Command with Wildcards

In MS-DOS 6.22, the DELTREE utility deletes all files and entire directory branches that match a specified wildcard pattern. While standard deletion commands only affect standalone files, running DELTREE with wildcards (* or ?) simultaneously purges matching individual files and completely recursively wipes out any matching subdirectories along with all of their contents.

When DELTREE processes a wildcard argument (such as DELTREE *.BAK or DELTREE TEMP*), it evaluates both files and directories in the target path against the pattern:

  • Matching Files: Any file meeting the wildcard criteria is immediately deleted. Unlike the standard DEL command, DELTREE ignores file attributes, automatically erasing files marked as Read-Only, Hidden, or System.
  • Matching Directories: Any directory matching the wildcard pattern is treated as the root of a deletion tree. The utility deletes the matching folder, every subdirectory nested inside it, and all files contained throughout the hierarchy, regardless of their attributes or whether the nested items match the original wildcard pattern.

By default, MS-DOS 6.22 prompts for confirmation for each individual file or directory that matches the wildcard mask before deleting it. Users can confirm with Y or skip the item with N. However, if the /Y switch is appended (for example, DELTREE /Y *.TMP), the command bypasses all confirmation prompts, executing the recursive deletion instantly across every matching entity.