The Easiest and Fastest Way to Delete A Large Folder in Windows

Normally, to delete a small amount of data in Windows, you can just either hit Delete key to send them to the Recycle Bin or Shift + Delete to permanently delete them right in the File Explorer (Windows Explorer) without getting into too much trouble. But both ways can safely be titled the worst way when it comes to cleaning up a large amount of data with a deep folder structure. It wastes so much time checking the contents before starting deleting anything. And it fails a lot more often than usual.

The bottom line, if you are facing a large amount of data to deal with, absolutely avoid using GUI tools like Windows Explorer or File Explorer. In a case like this, command lines work way better.

If you just want to clean up the files but keep the entire folder structure, the following does the job really well.

del /f /s /q foldername

/q is to run the command in quiet mode so no questions asked to delete on global wildcard.

Command Prompt - 2016-02-21 00_00_52

If you want to purge the entire folder including all sub-directories and files, the following can also get you there.

rmdir /s /q foldername

Same as above, it runs in the quiet mode that doesn’t ask if OK to remove a directory tree.

Command Prompt - 2016-02-21 00_01_08

The best way to get the job done the fastest is actually the combination of using both. Run DEL command first to delete all the files and then execute  RMDIR to clean up the folder structure. You can also output the DEL command to NIL to avoid the overhead to displays every single file that the command killed.

del /f /s /q foldername > nil
rmdir /s /q foldername

You can put both commands in a batch file to finish both jobs in one shot or put the batch job in the scheduler to run them in regularly if needed.

Kent Chen

Microsoft MVP, IT Professional, Developer, Geek, and the co-founder of Next of Windows.

Last updated: 02/21/2016

Posted in: Tips & Tricks
Discover more: , ,

Leave a Reply

Notify of
avatar
wpDiscuz
Today's Top Picks for Our Readers:
Recommended by Recommended by NetLine