@echo off setlocal EnableExtensions EnableDelayedExpansion rem ============================================================ rem Mirror specific folders from A (AvatarBase) to B (this repo) rem - Works relative to this .bat location rem - Wipes extras in destination (/MIR) rem - Logs removed extras (shown as *EXTRA File / *EXTRA Dir) rem - Pauses before exit so console stays open rem ============================================================ rem Destination root is the folder where this script lives set "SRC_ROOT=%~dp0" if "%SRC_ROOT:~-1%"=="\" set "SRC_ROOT=%SRC_ROOT:~0,-1%" rem Source root relative to this script set "DST_ROOT=%SRC_ROOT%\..\..\AvatarBase\Unreal" rem Canonicalize paths for %%I in ("%SRC_ROOT%") do set "SRC_ROOT=%%~fI" for %%I in ("%DST_ROOT%") do set "DST_ROOT=%%~fI" echo ============================================================ echo Robocopy Sync Script echo ============================================================ echo Source: %SRC_ROOT% echo Destination: %DST_ROOT% echo ============================================================ echo. rem Guard: only intended for subprojects if /I "%SRC_ROOT%"=="%DST_ROOT%" ( echo ERROR: Source and destination are identical: echo %SRC_ROOT% echo This sync script is intended to be run from subprojects only. echo. pause exit /b 1 ) if not exist "%SRC_ROOT%\" ( echo ERROR: Source root does not exist: echo %SRC_ROOT% echo. pause exit /b 2 ) echo ============================================================ echo Push back data from a project to avatar base? Are you sure? y/n echo ============================================================ :PROMPT SET /P AREYOUSURE=Are you sure (Y/[N])? IF /I "%AREYOUSURE%" NEQ "Y" GOTO END rem List of folders to mirror set "FOLDERS=Plugins\AvatarCore_AI Plugins\AvatarCore_Shared Plugins\AvatarCore_Manager Plugins\AvatarCore_MetaHuman Plugins\AvatarCore_STT Plugins\AvatarCore_TTS Plugins\BLogger Plugins\BSettings Plugins\BTools Plugins\RuntimeMetaHumanLipSync_5.6 Content\Project" set "ANY_FAIL=0" for %%F in (%FOLDERS%) do ( set "SRC=%SRC_ROOT%\%%F" set "DST=%DST_ROOT%\%%F" echo ------------------------------------------------------------ echo Mirroring: %%F echo FROM: !SRC! echo TO: !DST! echo ------------------------------------------------------------ if not exist "!SRC!\" ( echo WARNING: Source folder missing, skipping: !SRC! ) else ( if not exist "!DST!\" ( mkdir "!DST!" 2>nul ) robocopy "!SRC!" "!DST!" /MIR /DCOPY:DAT /COPY:DAT /R:2 /W:1 /FFT /Z /NP /FP /TS /TEE set "RC=!ERRORLEVEL!" echo Robocopy exit code: !RC! if !RC! GEQ 8 ( echo ERROR: Robocopy reported failure for %%F ^(exit code !RC!^) set "ANY_FAIL=1" ) ) echo. ) if "!ANY_FAIL!"=="1" ( echo ============================================================ echo Sync failed! echo ============================================================ pause exit /b 8 ) echo ============================================================ echo Sync finished. echo ============================================================ :END endlocal pause exit /b 0