Saturday, November 19, 2022

How to Delete “BIN and OBJ” folders via Batch file

We had issues deleting bin and obj folders when we check in code or share code with in teams.

Here is simple batch file that we can use to delete Bin and Obj folders.

1. Create an empty file and name it DeleteBinObjFolders.bat

2. Copy-paste the below code into the DeleteBinObjFolders.bat

@echo off
@echo Deleting all BIN and OBJ folders...
for /d /r . %%d in (bin obj) do @if exist "%%d" rd /s/q "%%d"
@echo BIN and OBJ folders successfully deleted.
pause > nul
  

3. copy this file to your solution (*.sln) location.

4. Go to your project folder via command prompt and run this file DeleteBinObjFolders.bat file which is in the same folder with your solution (*.sln) file.

Hope this helps!

No comments:

Post a Comment