Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions delete-bin.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@ECHO off
cls

ECHO Deleting all BIN and OBJ folders...
ECHO.

FOR /d /r . %%d in (bin,obj) DO (
IF EXIST "%%d" (
ECHO %%d | FIND /I "\node_modules\" > Nul && (
ECHO.Skipping: %%d
) || (
ECHO.Deleting: %%d
rd /s/q "%%d"
)
Comment on lines +13 to +14
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /q flag suppresses confirmation prompts, making this command potentially destructive without user awareness. Consider adding a confirmation prompt or verbose logging before deletion to prevent accidental data loss.

Suggested change
rd /s/q "%%d"
)
CHOICE /C YN /N /M "Are you sure you want to delete this folder? (Y/N): "
IF ERRORLEVEL 2 (
ECHO Skipped: %%d
) ELSE (
rd /s/q "%%d"
)

Copilot uses AI. Check for mistakes.
)
)

Comment on lines +8 to +17
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The node_modules exclusion logic is flawed. The FIND command will match any path containing '\node_modules' anywhere in the string, which could incorrectly skip legitimate bin/obj folders that happen to contain this substring in their path. Consider using a more precise pattern match or checking if the parent directory is specifically named 'node_modules'.

Suggested change
IF EXIST "%%d" (
ECHO %%d | FIND /I "\node_modules\" > Nul && (
ECHO.Skipping: %%d
) || (
ECHO.Deleting: %%d
rd /s/q "%%d"
)
)
)
IF EXIST "%%d" (
REM Extract parent directory name
FOR %%p IN ("%%~dpd.") DO (
SET "PARENT=%%~nxp"
CALL :CheckNodeModules "%%d" "%%PARENT%"
)
)
)
GOTO :EOF
:CheckNodeModules
SETLOCAL ENABLEDELAYEDEXPANSION
SET "DIR=%~1"
SET "PARENT=%~2"
IF /I "!PARENT!"=="node_modules" (
ECHO.Skipping: !DIR!
) ELSE (
ECHO.Deleting: !DIR!
rd /s/q "!DIR!"
)
ENDLOCAL
EXIT /B

Copilot uses AI. Check for mistakes.
ECHO.
ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit.
pause > nul
Loading