1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| @echo off title SVN Backup by oli
:: --------------------------------------- :: --------------------------------------- :: ---------------------------------------
set SVN_HOME="C:\Program Files\VisualSVN Server" :: 设置根目录 set SVN_ROOT=C:\Repositories :: 设置要备份到的位置 set SVN_BACKUP_ROOT=C:\Backup
set TIME_DIR=%date:~,4%%date:~5,2%%date:~8,2%_%time:~,2%%time:~3,2%%time:~6,2%%time:~9,2% set BACKUP_DIRECTORY=%SVN_BACKUP_ROOT%\%TIME_DIR% set LOG=%BACKUP_DIRECTORY%\backup.log
:: --------------------------------------- :: --------------------------------------- :: ---------------------------------------
if not exist %SVN_HOME% goto error
goto start
:start for /r %SVN_BACKUP_ROOT% %%I in (backup.log) do ( if %%~zI GEQ 1048576 ren %LOG% backup_%TIME%.log )
mkdir %BACKUP_DIRECTORY% @echo [info] create new directory: %BACKUP_DIRECTORY%
@echo [info] %date:~,10% %time:~,2%:%time:~3,2%:%time:~6,2% create backup category: %BACKUP_DIRECTORY% >>%LOG%
for /d %%i in (%SVN_ROOT%\*) do ( @echo [info] backup %%~ni >>%LOG% @echo [info] backup %%~ni
:: --incremental %SVN_HOME%\bin\svnadmin dump %SVN_ROOT%\%%~ni > %BACKUP_DIRECTORY%\%%~ni.dmp 2>>%LOG% )
@echo [info] %date:~,10% %time:~,2%:%time:~3,2%:%time:~6,2% finish: %errorlevel% @echo [info] %date:~,10% %time:~,2%:%time:~3,2%:%time:~6,2% finish: %errorlevel% >>%LOG%
:error echo [error] %date:~,10% %time:~,2%:%time:~3,2%:%time:~6,2% directory not exist,please check: %SVN_HOME%>>%LOG% goto end
:end @echo. >>%LOG% :: exit
PAUSE
|