Created
July 28, 2015 20:46
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rmdeep() { | |
cmd //c rmdeep.bat $1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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