Skip to content

Instantly share code, notes, and snippets.

@loopmode
Created July 28, 2015 20:46
Show Gist options
  • Save loopmode/35ef81b048ab57cdc86e to your computer and use it in GitHub Desktop.
Save loopmode/35ef81b048ab57cdc86e to your computer and use it in GitHub Desktop.
rmdeep.bat - fast deep delete, e.g. for node_modules. add to system path
rmdeep() {
cmd //c rmdeep.bat $1;
}
@echo off
setlocal
SET TARGET_DIR=%CD%\%1
SET TARGET_DIR=%TARGET_DIR:/=\%
IF NOT EXIST %TARGET_DIR% GOTO NOTFOUND
:PROMPT
SET /P AREYOUSURE=Permanently delete "%1" and all its contents? (y/[n])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO ABORT
:PROCEED
DEL /f/s/q %TARGET_DIR% > nul
RMDIR /s/q %TARGET_DIR%
GOTO DONE
endlocal
:DONE
ECHO Successfully deleted "%CD%\%1".
GOTO EXIT
:NOTFOUND
ECHO Target not found.
GOTO EXIT
:ABORT
ECHO Aborted.
GOTO EXIT
:EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment