tags:

views:

10196

answers:

5

I want to delete a folder that contains thousands of files and folders. If I use Windows Explorer to delete the folder it can take 10-15 minutes (not always, but often). Is there a faster way in Windows to delete folders?

Other details:

  • I don't care about the recycle bin.
  • It's an NTFS drive.
+24  A: 

Use Windows Command Prompt:

rmdir /s /q folder
Stephen Denne
btw, you can also use rd /q/s <foldername>however, while this is faster than the graphical representation inside Windows Explorer, it is still going to take a *long* time - MS uses a 'Schlemeil the Painter' algorithm (joelonsoftware.com/articles/fog0000000319.html) anytime a dir or del is done
warren
Thats not DOS! Thats just the command line tools for Windows
TFD
Agree with TFD -- someone should edit this post and change DOS to "the command prompt".
Richard West
rm -rf folder works wonderfully fast if you have Cygwin installed.
Sinan Ünür
+3  A: 

I don't have anything large enough to test but usually this is faster: Select the folder and then hold down the Shift key and then Delete. You'll be prompted about permanently deleting the files. No recycle bin should speed this up.

Jeffery Hicks
if you have thousands of files, this won't make such a big difference.
Geo
@Geo, I disagree, I've noticed a big difference between using shift vs using recycle bin with 250k files
Neil N
+1  A: 

use the command prompt, as suggested. I figured out why explorer is so slow a while ago, it gives you an estimate of how long it will take to delete the files/folders. To do this, it has to scan the number of items and the size. This takes ages, hence the ridiculous wait with large folders.

Also, explorer will stop if there is a particular problem with a file,

A: 

and to delete a lot of folders, you could also create a batch file with the command spdenne posted.

1) make a text file that has the following contents replacing the folder names in quotes with your folder names:

rmdir /s /q "My Apps"
rmdir /s /q "My Documents"
rmdir /s /q "My Pictures"
rmdir /s /q "My Work Files"

2) save the batch file with a .bat extension (for example deletefiles.bat)
3) open a command prompt (Start > Run > Cmd) and execute the batch file. you can do this like so from the command prompt (substituting X for your drive letter):

X:
deletefiles.bat

A: 

use fastcopy, a free tool. it has a delete option that is a lot faster then the way windows deletes files.

I tried FastCopy. not sure if it is faster than windows, I was only getting 92 files / second deleted. Considering I gave up counting the number of files at over 250K, its going to take me for ever to use.. Oh well. Each file is only like 20 bytes. Darn PHP Session Files.
Chrispix