Fastest Large Directory/Folder Delete Method

Really, the fastest way I've discovered to do it has been, "rmdir /s [directory]". It seems to involve a LOT less meta-data operations than a, "del ." does, which makes it very zippy. I use it regularly to remove home directories with many thousands of files. Absolutely way faster than a remove-directory from Explorer, which seems to feel the need to count all the files before removing.

I haven't gone up to 1TB yet. If that 1TB involves less than, say, 10K files the big metadata operations would be marking vast swaths of space as free in the MFT. If that 1TB involves millions of files, then the metadata operations start to really slow things down on a file-by-file level. In that case, rmdir /s beats the pants off of Explorer.


As sysadmin said, deleting individual files has massive overhead, so delete the folder. Regardless of the delete method you use, if you're going to delete a large number of files and/or folders it's worth temporarily disabling the AV software first. As a delete operation is both a read and a write the AV software is going to kick in and really slow things down, assuming of course you are running a real-time scanner.


I guess

rd /S /Q FolderToDelete

is the fastest option you have.

Warning: /S deletes all files and folders (tree) and /Q is the switch for "don't ask for confirmation."


Can I ask what you are trying to achieve ?

Unless you need the space back as quickly as possible then maybe the right method is to move the directory to a different location and spawn a thread that deletes files and directories slowly. This way the directory is not in the way and the server is not brought to its knees.