SVN regular daily backup script

SVN regular daily backup script:

 

OFF @ECHO 
REM SVN installation directory of 
the SET SVN_HOME = " D: \ Program Files \ VisualSVNServer " 
REM repository root directory of 
the SET REPOSITORY_ROOT = D: \ Repositories 
REM root directory of 
the SET BACK_HOME = E: \ svnbak 
REM backup directory 
the SET BACK_DIRECTORY =% BACK_HOME % \% DATE: ~ 0 , 10 % 
the SET back_log = BACK_HOME%% \ Backup.log 

 

SET DAYSAGO = 2 
Call: DateToDays % DATE : ~ 0 , . 4 %% DATE : ~ . 5 , 2 %% DATE: ~ . 8 , 2 % PassDays 
SET / A PassDays - =% DAYSAGO% 
Call: DaysToDate % PassDays% DstYear DstMonth DstDay 
SET DstDate =% DstYear% -% DstMonth% -% DstDay% 

the SET DEL_BACK_DIRECTORY =% BACK_HOME% \% DstDate% 

 

the IF eXIST % BACK_DIRECTORY% ( 
ECHO " backup directory% BACK_DIRECTORY% already exists! Please clear. " 
GOTO END 
) 

ECHO " delete the backup directory% DEL_BACK_DIRECTORY% " 

RD / q / S% DEL_BACK_DIRECTORY% "
 
ECHO " create a backup directory% BACK_DIRECTORY% " > >% back_log% 
MDBACK_DIRECTORY%% 
REM traversing the repository directory, back up each warehouse 
the FOR / R%%%% REPOSITORY_ROOT the I the IN (.) DO ( 
  IF EXIST " %% the I \ conf \ svnserve.conf " ( 
    ECHO " is backing up repository %% fI ~ " 
% SVN_HOME% \ BIN \ svnadmin hotcopy " %% ~ fI " % BACK_DIRECTORY% \ %% ~ nI 
    ECHO " repository %% ~ fI backed up to BACK_DIRECTORY%% \ %% ~ nI " 
) 
) 
GOTO END 

 

 

: DateToDays % mm%%%% YY dd % Days 
setlocal ENABLEEXTENSIONS 
SET YY =% . 1 & SET% mm = 2 & SETdd=%3
if 1%yy% LSS 200 if 1%yy% LSS 170 (set yy=20%yy%) else (set yy=19%yy%)
set /a dd=100%dd%%%100,mm=100%mm%%%100
set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2
set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633
endlocal & set %4=%j% & goto :EOF

:DaysToDate %days% yy mm dd
setlocal ENABLEEXTENSIONS
set /a a=%1+2472632,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=a
set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5
set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10
(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)
endlocal & set %2=%yy%& set %3=%mm%&set %4=%dd%& goto :EOF


:END

pause

EXIT

Guess you like

Origin www.cnblogs.com/huiy1/p/12033976.html