del (original) (raw)

Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

del

In this article

Deletes one or more files. This command performs the same actions as the erase command.

The del command can also run from the Windows Recovery Console, using different parameters. For more information, see Windows Recovery Environment (WinRE).

Warning

If you use del to delete a file from your disk, you can't retrieve it.

Syntax

del [/p] [/f] [/s] [/q] [/a[:]<attributes>] <names>
erase [/p] [/f] [/s] [/q] [/a[:]<attributes>] <names>

Parameters

Parameter Description
Specifies a list of one or more files or directories. Wildcards may be used to delete multiple files. If a directory is specified, all files within the directory will be deleted.
/p Prompts for confirmation before deleting the specified file.
/f Forces deletion of read-only files.
/s Deletes specified files from the current directory and all subdirectories. Displays the names of the files as they are being deleted.
/q Specifies quiet mode. You are not prompted for delete confirmation.
/a[:] Deletes files based on the following file attributes:r Read-only filesh Hidden filesi Not content indexed filess System filesa Files ready for archivingl Reparse points- Used as a prefix meaning 'not'.
/? Displays help at the command prompt.

Remarks

del \work  
del *.*  

The del command displays the following prompt:
Are you sure (Y/N)?
To delete all of the files in the current directory, press Y and then press ENTER. To cancel the deletion, press N and then press ENTER.
Note
Before you use wildcard characters with the del command, use the same wildcard characters with the dir command to list all the files that will be deleted.

Examples

To delete all the files in a folder named Test on drive C, type either of the following:

del c:\test
del c:\test\*.*

To delete all the files in a folder where the folder has a space in its name, the full path needs to be wrapped in double quotes. Type either of the following:

del "c:\test folder\"
del "c:\test folder\*.*"

To delete all files with the .bat file name extension from the current directory, type:

del *.bat

To delete all read-only files in the current directory, type:

del /a:r *.*

Feedback

Additional resources

In this article