call bin\setenv.bat
set PATH=%PATH%;%TRACPATH%
set PATH

@echo off

if not DEFINED TL_PROJECT_HOME set TL_PROJECT_HOME=%TRAC_LIGHT_HOME%\projects
if not DEFINED TL_BACKUP_DIR set TL_BACKUP_DIR=%TRAC_LIGHT_HOME%\backup

@echo %TL_BACKUP_DIR%ディレクトリにバックアップを作成します。
@echo 古いバックアップは削除されます。



rmdir /s /q "%TL_BACKUP_DIR%"
mkdir "%TL_BACKUP_DIR%\trac"
mkdir "%TL_BACKUP_DIR%\svn"
mkdir "%TL_BACKUP_DIR%\maven"
mkdir "%TL_BACKUP_DIR%\report"
mkdir "%TL_BACKUP_DIR%\hudson"


cd /d "%TL_PROJECT_HOME%"

for /d %%i in ("%TL_PROJECT_HOME%\trac\*") do ( 
	echo == Backup Project: %%~ni ==
	call trac-admin.bat trac\%%~ni hotcopy "%TL_BACKUP_DIR%\trac\%%~ni"
	call svnadmin hotcopy svn\%%~ni "%TL_BACKUP_DIR%\svn\%%~ni"
)

copy "%TL_PROJECT_HOME%\trac.htdigest" "%TL_BACKUP_DIR%"
copy "%TL_PROJECT_HOME%\svnauthz" "%TL_BACKUP_DIR%"
xcopy "%TL_PROJECT_HOME%\maven" "%TL_BACKUP_DIR%\maven" /e /c /h
xcopy "%TL_PROJECT_HOME%\report" "%TL_BACKUP_DIR%\report" /e /c /h
xcopy "%TL_PROJECT_HOME%\hudson" "%TL_BACKUP_DIR%\hudson" /e /c /h

@echo %TL_BACKUP_DIR%ディレクトリにバックアップしました。
