What do I add to my DEL batch file if I want to exclude a folder inside a folder I want to delete?
I have this code to delete my all the contents of the temp folder<
Here's some batch script code that'll do what you're asking.
for /d %%I in (c:\temp\*) do (
if /i not "%%~nxI" equ "imptfolder" rmdir /q /s "%%~I"
)
del /q c:\temp\*
If you're just entering these commands from the console, use single percents rather than double.
cd /d c:\temp
for /d %I in (*) do @(if /i not "%~I" equ "imptfolder" rmdir /q /s "%~I")
del /q *