I\'m trying to make a batch file on Windows for deleting all the files in the current directory but excluding 4 file extensions (log, sdb, SDK, bat).
I have tried th
\IF /I (case insensitive) optionThis should work
@echo off
forfiles /c "cmd /c if @isdir equ FALSE if /i not @ext==\"sdb\" if /i not @ext==\"sbk\" if /i not @ext==\"log\" if /i not @ext==\"bat\" del @file"
But the above is very slow, and it sure is a lot to type.
The following is much simpler and faster.
@echo off
for /f "delims=" %%F in ('dir /b /a-d ^| findstr /vile ".sdb .sbk .log .bat"') do del "%%F"