Thursday, September 20, 2012

A faster way to delete large folders in Windows without using 3rd party apps

Ever since Microsoft released Windows Vista, file deletion had been very slow in Windows Explorer. It was very noticeable when you were deleting a huge folder with hundreds of thousands of files.

I frequently encounter this problem at work. The XPS driver source itself is huge and for certain tests I have to check out multiple versions of the source. Ultimately you crowd up the hard drive with files that you don’t even want to refer again. Then there comes the day you have to clean up the junk because you are running out of space in the drive. Deleting files using the Windows Explorer will take forever. I usually did this while we were out for lunch.

But I was curious. There should be a faster way. And I found one, which is about 2 to 3 times faster than deleting them through Windows Explorer. But you lose the progress bar and the fancy animations.


Create a bat file with the following commands.

del /f/s/q %1 > nul
rmdir /s/q %1

Now all you have to do is to drag the folder you want to delete onto the bat file and it will do the job.

Here is a simple video demonstrating the file deletion.



I ran the test at work when I had some spare time. The folder contained 155,156 files and 14,684 folders. I downloaded same source twice to the hard drive and deleted using each method.

Specs of the PC

CPU: Intel Core i7 2600
RAM: 4GB DDR1333
HDD: Samsung HD642JJ HDD
OS: Windows 7 32bit SP1

Here are the results.

  • Deleing via Windows Explorer: 5 min 41 sec
  • Deleing via the bat file: 2 min 32 sec

It’s about 2.25 times faster than the usual way. Not bad at all!

Now, if anybody knows an even faster way, hit me up in the comments section.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...