With below I can delete all folders in C:Temp expect folder 123 but I want to add another folder 1234 and 12345 that should not be deleted once you run the script, can some help me how i can add folder 1234 & 12345.
pushd "C:Temp" || exit /B 1 for /D %%D in ("*") do (if /I not "%%~nxD"=="123" rd /S /Q "%%~D") for %%F in ("*") do (del "%%~F") popd
for /D %%D in ("*") do ( set "zapme=Y" for %%O IN (123 1234 12345) do if /I "%%~nxD"=="%%O" set "zapme=" if defined zapme rd /S /Q "%%~D" )
using zapme as a flag.
zapme
2.1m questions
2.1m answers
60 comments
56.8k users