2018-02-20 18:58:07 +00:00
|
|
|
# del
|
|
|
|
|
|
|
|
> Delete one or more files.
|
2023-10-25 10:00:02 +01:00
|
|
|
> In PowerShell, this command is an alias of `Remove-Item`. This documentation is based on the Command Prompt (`cmd`) version of `del`.
|
2022-10-04 16:06:23 +01:00
|
|
|
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/del>.
|
2018-02-20 18:58:07 +00:00
|
|
|
|
2023-10-25 10:00:02 +01:00
|
|
|
- View the documentation of the equivalent PowerShell command:
|
|
|
|
|
|
|
|
`tldr remove-item`
|
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
- Delete one or more files or patterns:
|
2018-02-20 18:58:07 +00:00
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`del {{file_pattern1 file_pattern2 ...}}`
|
2018-02-20 18:58:07 +00:00
|
|
|
|
|
|
|
- Prompt for confirmation before deleting each file:
|
|
|
|
|
|
|
|
`del {{file_pattern}} /p`
|
|
|
|
|
|
|
|
- Force the deletion of read-only files:
|
|
|
|
|
|
|
|
`del {{file_pattern}} /f`
|
|
|
|
|
|
|
|
- Recursively delete file(s) from all subdirectories:
|
|
|
|
|
|
|
|
`del {{file_pattern}} /s`
|
|
|
|
|
|
|
|
- Do not prompt when deleting files based on a global wildcard:
|
|
|
|
|
|
|
|
`del {{file_pattern}} /q`
|
|
|
|
|
|
|
|
- Display the help and list available attributes:
|
|
|
|
|
|
|
|
`del /?`
|
|
|
|
|
|
|
|
- Delete files based on specified attributes:
|
|
|
|
|
|
|
|
`del {{file_pattern}} /a {{attribute}}`
|