@echo off
setlocal EnableExtensions
cd /d "%~dp0"
set "STAMP=%date:~-4%%date:~4,2%%date:~7,2%-%time:~0,2%%time:~3,2%%time:~6,2%"
set "STAMP=%STAMP: =0%"
set "DEST=%CD%\Backups\manual-%STAMP%"
mkdir "%DEST%" >nul 2>nul

for %%D in ("App\data" "ClinicalReasoningDatabase\active" "ClinicalReasoningDatabase\exports" "ClinicalReasoningDatabase\research_exports" "ClinicalReasoningDatabase\owner-backups" "Logs") do (
  if exist "%CD%\%%~D" (
    mkdir "%DEST%\%%~D" >nul 2>nul
    xcopy "%CD%\%%~D\*" "%DEST%\%%~D\" /E /I /H /Y >nul
  )
)

echo.
echo Owner file data backed up to:
echo %DEST%
echo.
echo Browser workbench data must also be exported from:
echo Clinical Reasoning Database - Settings - Export Owner Backup
echo.
pause
