@echo off setlocal enabledelayedexpansion set TRUE_FALSE=FALSE for /d %%f in ("%1%\*") do ( if exist "%%f\Microsoft.Data.SqlClient.resources.dll" set TRUE_FALSE=TRUE if exist "%%f\Microsoft.TestPlatform.CoreUtilities.resources.dll" set TRUE_FALSE=TRUE if !TRUE_FALSE!==TRUE ( echo Deleting folder: %%f rmdir /s /q "%%f" ) ) endlocal