Skip to content

Instantly share code, notes, and snippets.

@ciscoheat
Last active May 11, 2023 06:46
Show Gist options
  • Save ciscoheat/d2e2e182122cdf3f0f179625d922c3a7 to your computer and use it in GitHub Desktop.
Save ciscoheat/d2e2e182122cdf3f0f179625d922c3a7 to your computer and use it in GitHub Desktop.
Batch file version of deleting large directories on Windows: https://stackoverflow.com/a/6208144/70894
@echo off
IF "%1" == "" (
echo Usage: rimraf ^[^/f^|-f^|--force^] dir
EXIT /B 1
)
IF "%1" == "/f" GOTO rimraf
IF "%1" == "/F" GOTO rimraf
IF "%1" == "-f" GOTO rimraf
IF "%1" == "--force" GOTO rimraf
echo Deleting %1
pause
:rimraf
SET remove=%1
IF NOT "%2" == "" SET remove=%2
IF EXIST "%remove%" del /f/s/q "%remove%" > nul
IF EXIST "%remove%" rmdir /s/q "%remove%"
:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment