DELTREE deletes an entire directory tree, including subdirectories.
DELTREE [/Y] [/V] [/D] [/X] [/Z:SERIOUSLY] filespec [filespec...]
drive The drive letter, e.g. C:
path The directory, e.g. \example
/Y Deletes specified directories without asking for
/V Reports the number of files and subdirectories
deleted, and their total size
/D Displays the debug info
/X For testing; don't actually delete anything
/Z:SERIOUSLY Do not prompt when root directory is specified
filespec The directory tree to be deleted, e.g. C:\OLDTREE
Note that several directory trees can be deleted with
/? Shows the help
For performance reasons DELTREE overwrites the first letter of each
filename/directory name by a '?'. It does not delete the file
itself, but it deallocates the space where the content of the file is
written. FreeDOS, as other DOSes, recognizes the renamed file/directory
(myfile.txt becomes ?yfile.txt; pathname becomes ?athname) as deleted,
no longer shows it and does not offer access to it. Programs like
DEBUG which have sector access are able to read the contents of the
file/directory. As long as you do not write on the drive you have a
chance to restore the files/directories again with UNDELETE, only
the first character of the filename/directory name will be lost
(_yfile.txt /_athname). The only ways to delete the file CONTENTS FOR
ABSOLUTELY CERTAIN are to fill the disk completely with other files or
by using a wipeout tool. The only way to delete a file/directory
NAME FOR ABSOLUTELY CERTAIN is to RENAME (REN) the file/directory
first (e.g. "a."/"a") and to delete it later (only correct at 8.3 -
not at long filenames/directory names!)
Switches must be before filespecs on command line - MS compatible
syntax! Otherwise they will be ignored.
Filespecs may name files, subdirectories, or DR DOS-style file lists.
DELTREE is a dangerous command! Use at your own risk.
DELTREE has the following EXITCODES (ERRORLEVEL):
01 Something could not be deleted
03 User abort (Q, control-C)
16 General syntax error, or buffer overflow
17 Not enough memory
18 DOS 3.0 or better required
19 Problem with list file
20 Internal buffer overflow
21 Error resolving directory name (dots_fix)
deltree /y c:\oldtree
deltree c:\test2\ asks for each subdirectory of \test2 if you really
want to delete it
deltree c:\test2 deletes all subdirectory of \test2
Please read this command's lsm file also.
You will find the updated version (internet) here and
the version described in this manual page here.
The lsm file contains information about the name of the programmer,
the download site, and some other command related information.
Copyright © 1998 Jim Hall, updated 2007 by W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.