Windows 10 deletes lots of tiny files super slowly. Can anything be done to speed it up?
From the image it looks like you are deleting the files through Explorer, which is the slowest method possible.
What you can do to improve:
Delete the files using Shift+Del so the deleted files are not moved to the Recycle Bin (no recovery possible)
Issue the delete from inside a Command prompt using a command similar to (use
del /?
to see all parameters):del /f /q *.* (del in current folder, add `/s` to traverse sub-folders) del /f /q /s folder
I don't know why Explorer is so slow, but you might consider putting each batch of images on a separate filesystem volume and quick-formatting the volume to delete them. Windows 10 has native support for mounting files as disk volumes. The speed of reformatting is independent of what's on the volume since it ignores the existing file system and just writes a new one.
Tens of thousands of 20K files sounds like not too many gigabytes. If the total size of all live batches is smaller than your physical RAM, you could also put them on RAM disks (using, e.g., ImDisk), still formatting or unmounting the volume to delete them. Even ordinary recursive deletion on the RAM disk might be much faster depending on what's causing the slowdown. This is obviously not an option if you need the files to survive a reboot.
One disadvantage of reformatting to delete is that you need to be an elevated administrator. Another is that you can accidentally format the wrong volume, but really any approach to mass deletion of files carries the risk of deleting the wrong ones. If you give the volumes descriptive labels like TempJpeg1
then formatting them is probably as mistake-proof as deleting a huge directory from the command line.
Disable any antivirus/antimalware real-time protection you have, at least for the duration of this operation. This includes Windows Defender. Also any anti-ransomware protection (as offered by some backup programs).
Real-time protection typically has hooks on file operations, and are historically notorious for drastically slowing down any operation involving large numbers of files.
If you feel the need to, you can re-enable them after the deletion is complete.