del
Deletes specified files.
Syntax
erase [Drive:][Path] FileName [...] [/p] [/f] [/s] [/q] [/a[:Attributes]]
Parameters
Remarks
-
Using /p
If you use /p, del displays the name of a file and sends the following message:
FileName, Delete (Y/N)?
To confirm the deletion, press Y. To cancel the deletion and display the next file name (that is, if you specified a group of files), press N. To stop the del command, press CTRL+C.
- Disabling command extensions
If you disable command extensions, the /s command-line option displays the names of any files that were not found, instead of displaying the names of files that are being deleted (that is, the behavior is reversed). For more information about disabling command extensions, see cmd in Related Topics.
- Deleting more than one file at a time
You can delete all of the files in a folder by typing del followed by [Drive:]Path. For example, the following command deletes all of the files in the \Work folder:
del \work
You can also use wildcards (that is, * and ?) to delete more than one file at a time. However, to avoid deleting files unintentionally you should use wildcards cautiously with the del command. For example, if you type the following command:
del *.*
The del command displays the following prompt:
All files in directory will be deleted! Are you sure (Y/N)?
To delete all of the files in the current folder, press Y and then press ENTER. To cancel the deletion, press N and then press ENTER.
Before you use wildcards with the del command to delete a group of files, view a list of all of the files included in the group by using the dir command with the same wildcards.
Important
- After you delete a file from your disk using del, you cannot retrieve it.
- The del command, with different parameters, is available from the Recovery Console.
Examples
del c:\test
del c:\test\*.*
Formatting legend
Format | Meaning |
Italic | Information that the user must supply |
Bold | Elements that the user must type exactly as shown |
Ellipsis (...) | Parameter that can be repeated several times in a command line |
Between brackets ([]) | Optional items |
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one |
Courier font | Code or program output |