Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a Windows XP box with an NTFS disk and deleting large amounts of files is extremely slow. If I select a folder that contains a large number of files in a tree of folders and delete (using shift-del to save the recycle bin) it takes time that seems to be directly proportional to the number of files within the folder before it even pops up the confirmation box. It then takes an even longer time to delete each file in the folder.

Is there a way to delete a folder in Windows and not having the time taken proportional to the number of files within it?

share|improve this question
    
possible duplicate of superuser.com/questions/74786 –  akira Dec 18 '09 at 12:57
    
And that is a duplicate of superuser.com/questions/19762/mass-deleting-files-in-windows –  Hugo May 27 '11 at 11:55
add comment

4 Answers

up vote 9 down vote accepted

Is there a way to delete a folder in Windows and not having the time taken proportional to the number of files within it?

I don't think so, but some methods are clearly much quicker than others.

The worst way is to send to Recycle Bin: you still need to delete them. Next worst is shift+delete with Windows Explorer: it wastes loads of time checking the contents before starting deleting anything.

Next best is to use rmdir /s/q foldername from the command line. del /f/s/q foldername is good too, but it leaves behind the directory structure.

The best I've found is a two line batch file with a first pass to delete files and outputs to nul to avoid the overhead of writing to screen for every singe file. A second pass then cleans up the remaining directory structure:

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

This is nearly three times faster than a single rmdir, based on time tests with a Windows XP encrypted disk, deleting ~30GB/1,000,000 files/15,000 folders: rmdir takes ~2.5 hours, del+rmdir takes ~53 minutes. More info here.

This is a regular task for me, so I usually move the stuff I need to delete to C:\stufftodelete and have those del+rmdir commands in a deletestuff.bat batch file. This is scheduled to run at night, but sometimes I need to run it during the day so the quicker the better.

share|improve this answer
add comment

Mass Directory Eraser - quickly delete thousands of files.

If you have ever deleted a large folder structure with thousands of files, you probably noticed that it can take quite some time for Windows to complete this procedure. Mass Directory Eraser can do the same in about 2 seconds.

Mass Directory Eraser is freeware.

share|improve this answer
    
This also worked splendid on my network drive with hundreds of thousands of files in a few minutes. –  Christian Davén Dec 1 '09 at 13:50
1  
Google Chrome says Mass Directory Eraser site has a malware. –  Junior Mayhé Dec 18 '09 at 12:52
add comment

Install gnutools for windows and run:

find YOURFOLDER -type d -maxdepth 3 | xargs rm -Rf
share|improve this answer
add comment

did you try using command prompt

rmdir /s /q foldername

all large file operations in GUIs are slow - mostly because visual feedback (progress bar) has to be repainted many times

share|improve this answer
3  
This is nonsense. Operation may be slow because GUI needs to count all files to estimate required time but not due to repainting. –  Bender Nov 30 '09 at 13:22
    
wrong ... I work with large folders constantly (mostly win2k server), and use TotalCommander to move/copy/delete stuff. I've noticed that if I minimize TC or put another application window on top of TC stuff gets done at least 50% faster. TC is still repainting visal stuff, but everything is ignored in compositing... –  nEJC Nov 30 '09 at 13:36
6  
Is your computer so slow that GUI operations impact disk I/O performance? Or is TotalCommander just incredibly poorly coded? The disk is hundreds or thousands of times slower than the CPU, RAM and Video card. If graphics are slowing down your disk writes you have major issues. –  Mr. Shiny and New 安宇 Nov 30 '09 at 14:04
    
The question had "not having the time taken proportional to the number of files" for a reason. I'm not looking for 50% faster. –  Sindri Traustason Dec 1 '09 at 10:44
    
@Sindri If you do it the command prompt way there should be almost no delay before system starts working its magic. As far as I understand this preprocessing is where your problem is. –  nEJC Dec 2 '09 at 15:35
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.