Skip to content

Instantly share code, notes, and snippets.

@koraysaritas
Created February 28, 2017 10:52
Show Gist options
  • Save koraysaritas/c0901d29f699ddd309b6730969f3ab8f to your computer and use it in GitHub Desktop.
Save koraysaritas/c0901d29f699ddd309b6730969f3ab8f to your computer and use it in GitHub Desktop.
Remove folders/files matching pattern recursively
# Remove folders matching pattern recursively
FOR /F "tokens=*" %G IN ('DIR /B /AD /S bin') DO RMDIR /S /Q "%G"
FOR /F "tokens=*" %G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%G"
FOR /F "tokens=*" %G IN ('DIR /B /AD /S .vs') DO RMDIR /S /Q "%G"
# Remove files matching pattern recursively
FOR /F "tokens=*" %G IN ('DIR /B /A /S *.log') DO DEL /F /S /Q /A "%G"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment