Skip to content

Commit 3a2d1fe

Browse files
committed
Win32: Rewrite rm.bat
`rd` cannot remove ordinary files, use `del` or `rd` for each entry.
1 parent 6be0ae3 commit 3a2d1fe

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

win32/rm.bat

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
@echo off
2+
setlocal
3+
set recursive=
24
:optloop
35
if "%1" == "-f" shift
46
if "%1" == "-r" (shift & set "recursive=1" & goto :optloop)
5-
if "%recursive%" == "1" goto :recursive
67
:begin
78
if "%1" == "" goto :end
89
set p=%1
9-
if exist "%p:/=\%" for %%I in ("%p:/=\%") do @del "%%I"
10+
if exist "%p:/=\%" for %%I in ("%p:/=\%") do (
11+
del /q "%%I" || if "%recursive%" == "1" rd /s /q "%%I"
12+
) 2> nul
1013
shift
1114
goto :begin
12-
:recursive
13-
if "%1" == "" goto :end
14-
set p=%1
15-
if exist "%p:/=\%" rd /s /q "%p:/=\%"
16-
shift
17-
goto :recursive
1815
:end

0 commit comments

Comments
 (0)