@echo off setlocal cd /d "%~dp0" REM ===== Clean Core (keep main.c) ===== if exist "Core\Src\main.c" ( copy /y "Core\Src\main.c" "main.c" >nul rmdir /s /q "Core" 2>nul mkdir "Core\Src" 2>nul copy /y "main.c" "Core\Src\main.c" >nul del /f /q "main.c" ) REM ===== Clean artifacts ===== call :del_file .mxproject call :del_file .cproject call :del_file .project call :del_file .clangd call :del_file *.json call :del_file *.ld call :del_file *.s call :del_dir .settings call :del_dir Drivers call :del_dir Debug call :del_dir Release call :del_dir build call :del_dir cmake exit /b :del_file if exist "%~1" del /f /q "%~1" exit /b :del_dir if exist "%~1\" rmdir /s /q "%~1" exit /b