I have a folder on my Server, it's 90GB big, and it has Millions of Files, and i want to delete it, but del /s /q took 3 days just to delete the first 1GB Folder, so my Idea would be, just writing 0's over the area where the files are, because deleting every file in a loop will probably take 270 Days at this rate.
1 Answers
Before you remove files, make sure you are on the host side. If you are deleting files over a network share, things will be slow. So remote into your server before deleting the files, and make sure you use the local drive to delete the files, not a network share pointing to the local drive.
Now, the next problem is making sure you are not going file-by-file, which is what the del command does.
Instead, you will want to use the rd (or rmdir) command. Normally an rd <folder> will throw in an error stating that the folder is not empty and will not delete it, but this is just a safeguard.
rd has an option to delete files too, namely /s.
So what you want to do is executing a rd /s <folder> and it will delete that folder with everything inside it in a matter of seconds.
- 61,264
-
Thank you, I didn't know deleting a folder with del was different from rd... :D – ishc3ice Apr 20 '20 at 14:41
-
Actually, it is not. The Windows API only has one way to delete files. One-by-one, that is. – Daniel B Apr 20 '20 at 18:19
rmdir? – Apr 19 '20 at 16:17