@echo off setlocal EnableDelayedExpansion REM Set source and destination set "SOURCE_DIR=%~dp0" if "%SOURCE_DIR:~-1%"=="\" set "SOURCE_DIR=%SOURCE_DIR:~0,-1%" set "EXPORT_DIR=%SOURCE_DIR%\export" echo ======================================================== echo Exporting Project to 'export' folder... echo Source: %SOURCE_DIR% echo Destination: %EXPORT_DIR% echo ======================================================== REM Create destination directory if not exist "%EXPORT_DIR%" mkdir "%EXPORT_DIR%" REM Use Robocopy to copy files with exclusions REM /MIR :: Mirror dictionary REM /XD :: Exclude Directories (Including 'export' to distinguish it from the source) robocopy "%SOURCE_DIR%" "%EXPORT_DIR%" /MIR /XD "node_modules" "venv" ".git" "__pycache__" ".idea" ".vscode" "dist" "build" "export" /XF "*.log" "*.pyc" "*.DS_Store" REM Reset error level (Robocopy returns non-zero on success) if %ERRORLEVEL% LEQ 7 set ERRORLEVEL=0 echo. echo ======================================================== echo Export Successful! echo Files are in: %EXPORT_DIR% echo ======================================================== REM Open the folder explorer "%EXPORT_DIR%" pause