Skip to content

Instantly share code, notes, and snippets.

@cmbaughman
Created October 16, 2018 19:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cmbaughman/c973fecbf27f410b03e011a08060233c to your computer and use it in GitHub Desktop.
Save cmbaughman/c973fecbf27f410b03e011a08060233c to your computer and use it in GitHub Desktop.
Faster Windows Deletion of Big Directories

Speed up deletion of large files & folders

Manual Instructions

  1. "Start" -> Run -> cmd
  2. cd to the directory. In this example I want to delete 'virtual' and all subfiles & folders cd ../virtual
  3. Run this command inside the directory:
  del /f/q/s *.* > nul
  1. Run this sequence to cd to the parent directory and delete all the folders inside of your folder (again my example is a folder called virtual):
  cd ..
  rmdir /q/s virtual

Add a Context Menu

  1. Put this in a file called quick_delete.bat:
@ECHO OFF
ECHO Delete Folder: %CD%?
PAUSE
SET FOLDER=%CD%
CD /
DEL /F/Q/S "%FOLDER%" > NUL
RMDIR /Q/S "%FOLDER%"
EXIT
  1. Move this file after saving to C:\Windows
  2. In regedit go to HKEY_CLASSES_ROOT\Directory\shell\
  3. Create a new key called Quick Delete
  4. Under that create another new key called command
  5. Click command then in the right pane double-click (Default) and set the "Data" to: cmd /c "cd %1 && quick_delete.bat"
  6. Now you can right click a directory and delete it fast!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment