Skip to content

Instantly share code, notes, and snippets.

@kolomenkin
Created June 12, 2017 12:52
Show Gist options
  • Save kolomenkin/f55162cffdc14169e6a8dbc823507bdf to your computer and use it in GitHub Desktop.
Save kolomenkin/f55162cffdc14169e6a8dbc823507bdf to your computer and use it in GitHub Desktop.
Delete all MSVC generated files from specified directory recursively
@echo off
if "%~1" == "" goto sub_help
REM ===================================================
setlocal
echo Removing all MSVC generated files from %1 recursively...
%~d1
cd "%~1" || goto sub_cd_error
echo Current directory: %CD%
pause
del *.pdb *.obj *.ipch *.tlog *.pch; *.lib *.ilk *.VC.db /s || goto sub_del_error
goto :eof
REM ===================================================
:sub_cd_error
echo ERROR! Changing current folder to %1 failed!
exit /B 1
goto :eof
REM ===================================================
:sub_del_error
echo ERROR! Deleting MSVC filed failed!
exit /B 2
goto :eof
REM ===================================================
:sub_help
echo Usage: clean_msvc_recursive.bat ^<directory_to_clean_recursive^>
goto :eof
REM ===================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment