How to delete large folders in Windows super fast
The fastest way to delete large folders and files in Windows is to take the command-line approach. You could either do it manually via CMD or create and run a batch file for quick deletion. These two methods are a lot faster than the traditional way of deleting using the Windows Explorer delete option.
But before I go through the superfast way to delete large folders, here’s the reason why it takes so much time. If you are in a hurry, jump to the next section for the solution.
Why Does Windows Take Time to Delete Large Folders?
When you delete huge folders in Windows, you will notice that the process takes quite a bit of time to complete. It is the opposite of fast.
I keep backup folders of gHacks locally on a platter-based drive, and these folders come close to 30 Gigabytes in size with more than 140,000 files and 350 folders.
When I need to delete them again, it takes a long time if I run the delete operation in Windows Explorer. The problem is that Windows prepares to delete first. This includes running calculations first, which, in itself may take a very long time to complete. Then comes the deletion part, even if you choose to delete the folders permanently (force delete).
Then when the actual deleting takes place, Windows analyzes the process and posts updates to the file operation window.
It may take ten or twenty minutes, or even longer, to delete a large folder (of size greater than 10 GB, for instance) from your hard disk using Explorer on Windows devices.
Delete Large Folders in Windows Quickly Using CMD
If you run delete commands from the command line instead, you will notice that the operation completes a lot faster. You may notice that the operation needs just a fraction of the time that the same operation requires when you run it in Explorer.
Matt Pilz, who wrote about this back in 2015 saw a reduction from 11 minutes to 29 seconds, which made the command line operation more than 20 times faster than the Explorer option.
The downside to this is that it requires the use of the command line. Matt suggested adding the commands to the Explorer context menu so that users could run them in Explorer directly. This makes it both faster and easier.
The two commands that users require are Del, for deleting files, and Rmdir, for removing directories.
Here’s the step-by-step process to delete large folders using CMD:
- Tap on the Windows-key, type cmd.exe and select the result to load the command prompt.
- Navigate to the folder that you want to delete (with all its files and subfolders). Use cd path, e.g. cd o:\backups\test\ to do so.
- The command DEL /F/Q/S *.* > NUL deletes all files in that folder structure, and omits the output which improves the process further.
- Use cd.. to navigate to the parent folder afterwards.
- Run the command RMDIR /Q/S foldername to delete the folder and all of its subfolders.
Here are descriptions of each of the commands used above.
DEL /F/Q/S *.* > NUL
- /F -- forces the deletion of read-only files.
- /Q -- enables quiet mode. You are not asked if it is ok to delete files (if you don't use this, you are asked for any file in the folder, which can be time-consuming and therefore counter-productive).
- /S -- runs the command on all files in any folder under the selected structure.
- *.* -- delete all files.
- > NUL -- disables console output. This improves the process further, shaving off about one quarter of the processing time off of the console command.
RMDIR /Q/S foldername
- /Q -- Quiet mode, won't prompt for confirmation to delete folders.
- /S -- Run the operation on all folders of the selected path.
- foldername -- The absolute path or relative folder name, e.g. o:/backup/test1 or test1
Method #2: Creating a Batch File for Quick Deletion
If you don't need to run the command often, you may be perfectly fine running the commands directly from the command prompt.
However, if you do use it frequently, you may prefer to optimize the process. You may add the command to the Explorer context menu so that you can run it from there directly. This saves even more time without depending on a third-party software.
For this, the first thing you need to do is create a batch file. Create a new plain text document on Windows, and paste the following lines of code into it.
ECHO Delete Folder: %CD%?
DEL /F/Q/S "%FOLDER%" > NUL
RMDIR /Q/S "%FOLDER%"
Save the file as delete.bat afterwards. Make sure it has the .bat extension, and not the .txt extension. You can do this by selecting Save as type as All Files.
The batch file comes with a security prompt. This provides you with an option to stop the process; important if you have selected the context menu item by accident. You can use CTRL-C or click on the x of the window to stop the process. If you press any other key, all folders and files will be deleted without any option to stop the process.
You need to add the batch file to a location that is a PATH-environment variable. While you may create your own variable, you may also move it to a folder that is already supported; e.g.: C:\Windows. In other words, you need to place this .bat file in C:\Windows so that the Windows registry can easily access it.
Do the following to add the new batch file to delete folders quickly to the Windows Explorer context menu. This can be executed in all major versions of Windows including Windows XP, Windows 7, and Windows 10.
- Tap on the Windows key, type regedit.exe, and tap in the Enter key to open the Windows Registry Editor.
- Confirm the UAC prompt.
- Go to HKEY_CLASSES_ROOT\Directory\shell\
- Right-click on Shell and select New > Key.
- Name the key Fast Delete
- Right-click on Fast Delete, and select New > Key.
- Name the key command.
- Double-click on default of the command key.
- Add cmd /c "cd %1 && delete.bat" as the value.
If you want to speed up the deletion process even further, you can always check some third-party tool like byenow.Advertisement