DELTREE

Command in DOS and Windows 9x


title: "DELTREE" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["external-dos-commands", "windows-administration", "file-deletion"] description: "Command in DOS and Windows 9x" topic_path: "technology/operating-systems" source: "https://en.wikipedia.org/wiki/DELTREE" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Command in DOS and Windows 9x ::

::data[format=table title="Infobox software"]

FieldValue
nameDELTREE
developerMicrosoft, Datalight, Charles Dye
released
operating systemMS-DOS 6, SpartaDOS X, ROM-DOS, FreeDOS, Windows 9x
genreCommand
licenseMS-DOS, ROM-DOS, Windows: Proprietary commercial software
FreeDOS: GPL v2
::

| name = DELTREE | developer = Microsoft, Datalight, Charles Dye | released = | operating system = MS-DOS 6, SpartaDOS X, ROM-DOS, FreeDOS, Windows 9x | genre = Command | license = MS-DOS, ROM-DOS, Windows: Proprietary commercial software FreeDOS: GPL v2 In computing, DELTREE (short for delete tree) is a command line command in some Microsoft operating systems, SpartaDOS X and FreeDOS that recursively deletes an entire subdirectory of files.

Overview

When IBM and Microsoft introduced PC DOS 1.0 and MS-DOS 1.0, subdirectories were not yet supported. This state of affairs was remedied with the release of DOS 2.0, which introduced support for subdirectories and directory nesting; however, it had no built-in facility for deleting entire subdirectory trees. Through the release of MS-DOS 5.0, removing nested subdirectories required removing all of the files in the lowest subdirectories, then removing the subdirectory itself, then repeating the process up the directory tree. By 1991 at least one competing product, DR-DOS, had introduced a well-received utility that enabled recursive file deletion. With the introduction of MS-DOS 6.0, Microsoft regained parity by adding the DELTREE command.

DELTREE was retained in Windows 9x but was not shipped in Windows NT family of operating systems. Instead, the [rmdir](rmdir) (alias rd) command removes a subdirectory along with all its files if the /S command-line switch is given.

Implementations

In MS-DOS, PC DOS and Windows 9x, DELTREE was implemented as an external command, with its functionality kept in a separate file outside of COMMAND.COM. Normal operation prompted the user for verification that the specified directories were indeed intended to be removed, but this safeguard could be suppressed with a command-line option. Unlike most other commands that operated on the file system, multiple directories could be passed to the command at one time. An undocumented feature allowed the user to append a trailing "/" character to a directory name in order to preserve the directory but remove everything underneath it. In theory, deleted material could be recovered.

Datalight ROM-DOS also includes an implementation of the command.

The FreeDOS version was developed by Charles Dye and is licensed under the GPL v2.

Syntax

The command-syntax is: DELTREE[/Y][DRIVE:][PATH]

Use in malware and sabotage

DELTREE was designed to ignore all file and directory attributes, such as hidden, read-only and system. The command was described as "potentially dangerous" and "capable of wiping out hundreds of files at a time". Combined with the PURGE command (which prevented data recovery), it became an example of a worst-case payload for malware as well as figuring in one of the early computer sabotage trials.

Contributing to the problem is the fact that MS-DOS and Windows 9x do not support discretionary access control to mitigate this issue. The Windows NT family does. Furthermore, starting with Windows Vista, mandatory access control and User Account Control further mitigate the issue.

References

References

  1. "SpartaDOS X 4.48 User Guide".
  2. (29 June 2018). "The FreeDOS Project blog: FreeDOS commands quick-reference".
  3. Dickinson, John. (May 28, 1985). "Stalking the Elusive Subdirectory Path". PC Magazine.
  4. [http://malektips.com/2000wd0008.html No DELTREE Command? - MalekTips] {{webarchive. link. (March 17, 2010)
  5. "Datalight ROM-DOS User's Guide".
  6. (2013-03-30). "FreeDOS 1.2 Updates Package - deltree (FreeDOS Base)". Ibiblio.org.
  7. Glass, Brett. (July 8, 1991). "MS-DOS 5: Reigning OS improves its value". InfoWorld.
  8. Crayton, Christopher. (2008). "The A+ Exams Guide: Preparation Guide for the CompTIA Essentials". CompTIA.
  9. Cooper, Jim. (2002). "Using MS-DOS 6.22". Que.
  10. Mueller, John Paul. (2007). "Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000". Wiley.
  11. Rubenking, Neil J.. (November 19, 1996). "User-to-User". PC Magazine.
  12. Glass, Brett. (May 2, 1994). "How to safely defuse an ANSI bomb; video scan converters". InfoWorld.
  13. (2016-03-03). "Electronic Evidence and Discovery: What every Lawyer Should Know". ABA.
  14. Gaudin, Sharon. (2000). "Case Study of Insider Sabotage: The Tim Lloyd/Omega Case".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

external-dos-commandswindows-administrationfile-deletion