Deleting a folder with huge number of subfolders is very slow in Windows

0

I have a hierarchy of folders (millions of them) and I want to delete the parent node.

It's OK and it gets deleted. My CPU usage becomes 100% on all logical cores, but the memory doesn't complain and won't be increased.

I use command line's rmdir DirPath /s command for this.

My problem is that, it's TOO SLOW. My situation is like the situation in this question, but I don't have memory problems. I have time problem. I want to find a fast way.

Somewhere someone suggested that I take a backup and the files (which is far more slower than deleting), and then format the disk (which means that the hierarchy should be the only think on that disk). That option is not feasible for me.

Is there a fast way in Windows to delete a huge hierarchy of files and folders?

Saeed Neamati

Posted 2015-11-16T06:57:20.830

Reputation: 1 403

1As your issue is speed i suppose this is a task to be performed multiple times / cyclically. Is it like that? If so, you could use the "format the disk" option by making sure these directories / files are stored alone on one logical disk / partition. If not there are some "hackaround-tools" that improve the multicore usage by deleting subbranches in different threads, but to be honest i never used on of them and have no information on the "boost" they could give you. – R4PH43L – 2015-11-16T07:04:06.153

"Slow", compared to what? – kreemoweet – 2015-11-26T05:58:41.937

@kreemoweet, slow compared to routine operations. Slow compared to what my PC does when I delete a folder which is deleting it in seconds. This one takes hours. – Saeed Neamati – 2015-11-26T07:41:40.270

No answers