window svn backup.bat

3605 ワード

help 

command /?

call /?



%cd%           ,         ;   ,      :+    ,  dos     c:\dir    , 



%0         

%~d0           

%~dp0       



cd %~dp0             
at 23:30 /every:M,T,W,Th,F,S,Su  "E:\svn-backup.bat"



rem svn-backup.bat

echo off

rem Subversion     

set SVN_HOME="C:\Program Files\VisualSVN Server"

rem          

set SVN_ROOT=E:\Repositories

rem      

set BACKUP_SVN_ROOT=G:\svnbak

set BACKUP_DIRECTORY=%BACKUP_SVN_ROOT%\%date:~0,4%-%date:~5,2%-%date:~8,2%

if exist %BACKUP_DIRECTORY% goto checkBack

echo       %BACKUP_DIRECTORY%>>%SVN_ROOT%\backup.log

md %BACKUP_DIRECTORY%

rem           ,          SVN  

for /r %SVN_ROOT% %%I in (.) do @if exist "%%I\conf\svnserve.conf" %SVN_ROOT%\simpleBackup.bat "%%~fI" %%~nI

goto end

:checkBack

echo     %BACKUP_DIRECTORY%    ,   。

goto end

:end



rem simpleBackup.bat 

@echo        %1......

@%SVN_HOME%\bin\svnadmin hotcopy %1 %BACKUP_DIRECTORY%\%2

@echo    %1      %2

:http://zhidao.baidu.com/link?url=RIWqDMmK74jS33tIkzzLKNpZQAV-qVcPOJ7OCzrvm-rag-i-h1S-WPpWwzlsTLMN9ZK_4DzMRMJZUyMIFqho8b9mFEKWTNMH6F4PJiu4PeG