How to batch delete files on Windows 10

1. Batch delete files by Command Prompt

Command Prompt has two powerful file deletion commands: DEL and rmdir.

DEL is quite easy to understand is the command to delete a file, while rmdir is the command to delete the entire directory. You can add parameters to both commands to delete and remove specific file types, or simply delete everything.

Warning:

The rmdir command is very powerful and potentially dangerous. It removes the entire directory, including the file structure and everything in it. If you delete an important folder using this command by mistake, you may have to reinstall Win.

Delete a single file

To delete a file, use the following command:

del C:enteryourpathhere /f /s

The basic command locates the specified directory, while the / s parameter will delete all the files contained in the subdirectories and the / f parameter ignores any read-only settings.

Alternatively, go to the folder containing the files you want to delete, press Shift + Right click and select Open a command window here . Then, type "del [filename]" and press Enter.

Delete a specific file type

What if you want to delete a specific file type from a directory? You can do that by using the following command:

del * .extension

Change "extension" to the file type you want to delete.

You can extend the command to remove all specific file extensions from subfolders with the addition of some parameters:

del /s /q *.extension

Alternatively, if you want to delete multiple file types, you can add multiple types of extensions:

del /s /q *.png *.svg

How to batch delete files on Windows 10 Picture 1

Delete files and folders

The preceding commands leave the file structure behind, which can be frustrating if you want to batch delete everything. If you want to delete folders with files, you can use the following commands:

del /f /s /q C:enteryourpathhere > nul rmdir /s /q C:enteryourpathhere

There are a few other parameters shown here. Nul is a special file that removes all data written to it, meaning that a somewhat time-consuming enumeration process will not be written to the file, while / q chooses "silent mode".

2. Batch delete files using batch file

A cell batch file is a script you can run to perform certain tasks on your system. If you know how to create a sequence of commands, you can build a long script to automate tasks and save time. In this case, the article will use some basic commands to write batch delete commands.

For this example, we will delete the MUO Batch Rename folder we created for the previous examples. Right click on the desktop and go to New> Text Document . Name it BatchDelete and open it.

The batch file example requires you to know which directory you want to delete the file in. This sounds obvious, but you need the exact file path of the directory.

If you are unsure of the correct path for the folder, right-click and choose Properties , see the location there. Or, browse to the folder and click once in the address box to show the directory path directly.

Either way, make sure you have the correct directory as it will be wiped from the system soon.

You can copy and paste the following into your batch file. You should replace "enteryourpathhere" with the directory path.

cd C:enteryourpathhere del * /S /Q rmdir /S /Q C:enteryourpathhere

After you copy, paste and add the path to the folder, choose File> Save . Now, find your BatchDelete.txt file and press F2 to rename the file. Change the file extension from .txt to .bat and press Enter when you get a warning.

Congratulations, you've just created your first batch file!

Please note that you will have to update the directory path when you want to use the batch file again.

4 ★ | 13 Vote

May be interested

  • How to Launch BAT Files on WindowsHow to Launch BAT Files on Windows
    tipsmake today will show you how to launch bat files (also known as batch files) on windows computers. batch files are used for many purposes, such as automating frequently used tasks. you can launch the file in file explorer as usual, or execute it from the command line in the command prompt.
  • How to Execute batch file from command line on WindowsHow to Execute batch file from command line on Windows
    today's tipsmake will show you how to execute batch files (script files with .bat extension) from the windows command line. you can run the program from the 'run' dialog box, or type the command into a terminal window.
  • Instructions for creating and using BAT file on WindowsInstructions for creating and using BAT file on Windows
    how to create a simple batch file and some basics about it will be presented in this article. at the same time you will be provided with some resources for learning and writing batch files.
  • Automate TELNET commands using VB ScriptAutomate TELNET commands using VB Script
    batch processing with batch files (batch jobs) and recently using windows scripts (.wsf) are the top choice for network administrators, to increase productivity in a dark way. the best.
  • Delete files on Mac directly without the Trash trashDelete files on Mac directly without the Trash trash
    on windows operating systems, you can delete files permanently by pressing and holding the shift key. however, this is not available on mac. and wait until os x 10.11 el capitan mac users can use this feature.
  • How to add trash to permanently delete files on Windows 10/11How to add trash to permanently delete files on Windows 10/11
    do you want a recycle bin on your windows 10 or 11 desktop that actually deletes files that are dragged into it and cannot be recovered? the good news is that you can do this using free file wiper and multi trash.
  • Top 5 software for fast batch file renamingTop 5 software for fast batch file renaming
    top 5 software for fast batch file renaming. batch renaming files makes it easy to manage large files such as images or documents. of course, to be able to rename files in batches according to their own needs we need the help of
  • How to automate batch files using Task Scheduler on WindowsHow to automate batch files using Task Scheduler on Windows
    it can be quite tiring having to run batch files over and over again during certain times or events on your computer.
  • How to batch delete photos in Excel - No need to delete them manuallyHow to batch delete photos in Excel - No need to delete them manually
    to batch delete images in an excel file, you can do it through the go to special tool or use vba. all images are quickly deleted after following a few simple steps, instead of manually deleting each image.
  • Task automation tools on Windows 10Task automation tools on Windows 10
    did you realize that you regularly delete old files, clean up unnecessary data, launch some programs, etc. manually? if so, let quantrimang help you automate these tasks.