How can I speed up the deleting of very large directories on XP?
I regularly check out incredibly huge directories onto my XP machine. When it comes down to deleting and finally trashing them, it takes forever. Is there any way to speed this process up?
I usually delete huge directories from the command line. It bypasses the Trash and is typically much faster. You should be careful and check the command you type twice, so as not to accidentally delete something really important.
The easiest way is to use rmdir
:
rmdir /S /Q C:\My\Directory\Name
You need /Q
to stop rmdir
asking you if you're sure or not.
If some files are currently open by some process, they and the directories they contain naturally won't be deleted. There are tools that can help you understand which process locks the file, but it's a different story from this one.
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.
Press SHIFT + DELETE to delete files/directories while skipping the recycle bin.
Note: You cannot recover these files, but it's faster!
If you want to bypass the recycle bin just hold down the shift key while deleting, also sometimes I find the command line del command to be quicker than deleting through explorer. If it's always the same folder you're deleting set up a batch file for it.
You could even schedule it to happen on a regular basis if that's suitable.