Remove-Empty-Directories
Remove-Empty-Directories copied to clipboard
Hog on Vista
On my Windows Vista (x86) machine RED scans 15000 odd mixed content and empty folders just fine at first. During this time it uses a modest amount of the processor and grows in RAM at a reasonable rate. It grows to about 35 MB of RAM. Then I click 'Delete Folders'. RED starts deleting folders, but it also starts growing in RAM (it also makes hefty use of the processor for some reason). Eventually it eats through all the RAM it can and throws an out of memory error.
I usually don't see an out of memory error, but often see it using 1.5+ GB RAM when deleting a lot of folders.
Also massive CPU usage here - all 4 Cores had 80% load (Intel i5)! And deletion was very slow - deleting a total of 140 files in over 3min. (Pause between each deletion set to 0; files on external USB-HDD; Win 7)
Don't set it to 0, at least set it to 1 ms - a millisecond is hardly noticable to you, but it gives the CPU time (a millisecond) to pause. I have mine on 10 ms and folders still delete reasonably fast.
Ok I'm pretty sure I've figured out why it can be slow on some PC's (delay doesn't matter) - RED is trying to move the folders to the recycle bin. Set it to permanently delete them, and it's lightning fast (I got about 200+ folders deleted per second).
Hi guys, sorry for the late reply. Thanks for the research! Good to now that the "move to recycle bin" option can be the cause for a slow progress and a lot of wasted RAM. I'm currently working on a new version, maybe I can add a info or warning message for this case. Thanks again! :)