Command: erase
ERASE deletes one or more files.
Syntax:
ERASE [drive][path]filename [/P] [/V] [/?]
drive Specifies the drive letter where the file is, e.g. C:
path Specifies the path to where the file is, e.g. \example\
filename Specifies the file(s) to delete. Specify multiple
files by using wildcards (*,?).
A period may be used to specify all files in the
current directory, and is the same as *.*
Options:
/P Prompts for confirmation before deleting each file.
/V Displays all deleted files.
/? Shows the help.
Comments:
For performance reasons ERASE overwrites the first letter of the
filename 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 (myfile.txt
becomes ?yfile.txt) 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. As long as you do not write on the
drive you have a chance to restore the file again with UNDELETE, only
the first character of the filename will be lost (_yfile.txt). 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 NAME FOR ABSOLUTELY CERTAIN is to
RENAME (REN) the file first (e.g. "a.") and to delete it later (only
correct at 8.3 - not at long filenames!) You can also use DEL instead
of ERASE.
ERASE is a command internal to command.com and needs no other file
in order to work.
Examples:
erase C:\PROGRAM\test.txt
See also:
debug
del
deltree
rd
ren
rename
rmdir
undelete
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.