Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ezhov-da/056162eac46f6293246903a73679e256 to your computer and use it in GitHub Desktop.
Save ezhov-da/056162eac46f6293246903a73679e256 to your computer and use it in GitHub Desktop.
исключение папки из удаления
rem https://stackoverflow.com/questions/15547674/exclude-a-folder-inside-temp-when-executing-a-del-batch-file
rem 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\*
rem 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 *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment