mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 05:29:10 +02:00

- `if exist` and `del` ignore directories matching the wildcard, remove both separately. - `rd /s` ignores wildcards, while `del` removes ordinary files by the wildcard, iterate over matching directories by `for /D`.
18 lines
404 B
Batchfile
Executable file
18 lines
404 B
Batchfile
Executable file
@echo off
|
|
setlocal
|
|
set recursive=
|
|
:optloop
|
|
if "%1" == "-f" shift
|
|
if "%1" == "-r" (shift & set "recursive=1" & goto :optloop)
|
|
if "%1" == "--debug" (shift & set PROMPT=$E[34m+$E[m$S & echo on & goto :optloop)
|
|
:begin
|
|
if "%1" == "" goto :end
|
|
set p=%1
|
|
set p=%p:/=\%
|
|
if exist "%p%" del /q "%p%" > nul
|
|
if "%recursive%" == "1" for /D %%I in (%p%) do (
|
|
rd /s /q %%I
|
|
)
|
|
shift
|
|
goto :begin
|
|
:end
|