I had a problem a while back where I had roughly 600k+ files in a folder inside my temp folder (I was running a video downloader and it downloaded videos in parts, and after it merged the parts together it never deleted the thousands of temp files) in Windows 10, and I wanted to clear them all out. The recycle bin couldn’t handle anywhere near that many files, so I wasn’t able to use the recycle bin’s GUI to empty it. It was taking forever to load, and my RAM usage was increasing a lot. This is a known bug (2018 post, 2022 post), but fortunately there’s a way around this.

Delete files inside the recycle bin using command prompt

Run Command Prompt as administrator, then run this command. This is assuming your recycle bin is on your C drive, if it’s located somewhere else replace C with the drive letter it’s on.

(Note: this command doesn’t work in PowerShell):

rmdir /s /q C:\$RECYCLE.BIN

A breakdown of the above command: 1 2

  • /s means delete all files and subfolders inside the specified folder (i.e. recursive)
  • /q means quiet mode, so no prompts will be given to you when deleting everything

Delete files permanently before they become a problem (skip the recycle bin)

Instead of moving thousands of files to the recycle bin then emptying it, you can skip the recycle bin by permanently deleting files.

First navigate to the parent folder of the folder you want to delete using cd:

cd path/to/parent/folder

dangerous Danger

Triple check you typed the name of the right folder, because everything inside it will be deleted very quickly. If you need to cancel running a command before too much damage is done, press ctrl + c multiple times while the command prompt running the command has focus / is selected.

Then run these commands inside the parent folder:

del /f /q /s FOLDERNAME > nul
rmdir /s /q FOLDERNAME

A breakdown of the first command, del: 3 4

  • /f means force delete all files, even the read-only ones
  • /q means quiet mode, so no confirmation prompts will be given to you
  • /s means delete all files from the specified folder and from all subfolders (i.e. recursive)
  • FOLDERNAME replace this with the folder you want all files to be deleted in (all files in subfolders also get deleted)
  • > nul is so all the deleted files aren’t displayed in the command prompt, so the command runs slightly faster and cleaner (especially when deleting thousands of files). If you want to see the output of everything being deleted, run the command without it: del /f /q /s FOLDERNAME

A breakdown of the second command, rmdir:

  • /s means delete all files and subfolders inside the specified folder (i.e. recursive)
  • /q means quiet mode, so no prompts will be given to you when deleting everything
  • FOLDERNAME replace this with the folder you want all subfolders and itself to be deleted

info Info

The rmdir command above can also remove files (not just folders), but it’s much slower so that’s why we run the del command first.

Essentially, the first command (del) deletes all the files (from the specified folder and all subfolders), while the second command (rmdir) deletes all the subfolders and then the specified folder. So you don’t have to run the second command if there’s no subfolders.

This deleted everything inside my temp folder pretty fast. It took maybe a minute or two to delete ~600k files on my SSD.


  1. Can’t clear Recycle Bin, too many files ↩︎

  2. rmdir flags ↩︎

  3. del flags ↩︎

  4. What’s the fastest way to delete a large folder in Windows? ↩︎