The Computer Oracle

Windows 10 deletes lots of tiny files super slowly. Can anything be done to speed it up?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Over Ancient Waters Looping

--

Chapters
00:00 Windows 10 Deletes Lots Of Tiny Files Super Slowly. Can Anything Be Done To Speed It Up?
00:28 Accepted Answer Score 101
01:07 Answer 2 Score 31
02:33 Answer 3 Score 29
03:11 Answer 4 Score 16
03:37 Answer 5 Score 8
03:54 Thank you

--

Full question
https://superuser.com/questions/1485083/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows10 #filemanagement

#avk47



ACCEPTED ANSWER

Score 101


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
    



ANSWER 2

Score 31


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.




ANSWER 3

Score 29


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.




ANSWER 4

Score 16


Running this as a command will be a lot faster. Launch cmd and run

RD frames /S /Q

That will remove the folder and all its files and subdirectories in it, without spamming the screen with each file name it is deleting.

RD = remove directory
/S = subdirectories included
/Q = quiet mode



ANSWER 5

Score 8


Create a partition per batch, let's say 10GB or so, when done with given batch quick format the partition. All files gone in matter of seconds.