Basic environment:
On Windows using Visual SVN as SVN repository, has been running for a long time, want to back up a bit, to prevent the code and the file is missing, the script below provides backup and restore, on the implementation of the corresponding directory, for example: if the SVN library D: \ under Repositories, put the script in this directory to perform.
1, file backup
svnbackup.bat contents of the file:
echo OFF
rem Subversion installation directory
set SVN_HOME = "E: \ Program Files \ VisualSVN Server"
Father rem all repository directory
set SVN_ROOT = E: \ Repositories
directory rem to back up
the SET BACKUP_SVN_ROOT = E: \ Backup
the SET backup_directory =% BACKUP_SVN_ROOT % \% DATE: ~ 0,4% _% DATE: ~ 5,2% _% DATE: ~ 8,2%
IF exist% backup_directory% GOTO checkBack
echo to create a backup directory% bACKUP_DIRECTORY% >>% SVN_ROOT% / backup. log
md% backup_directory%
REM verify whether the repository directory, and if you remove the name of the backup
for / r% SVN_ROOT% %% I in (.) do @if exist "%% I \ conf \ svnserve.conf". \ simpleBackup .bat "%% ~ fI" %% ~ nI
GOTO End
: checkBack
echo% bACKUP_DIRECTORY% backup directory already exists, clear.
End GOTO
: End
simpleBackup.bat file contents
echo being backed up ...... repository% 1
% SVN_HOME% \ bin \ svnadmin hotcopy backup_directory%%% 1 \% 2
echo repository successfully backed up to% 1% 2!
==============================================================
2, file restore
svnrecover.bat file contents
echo OFF
rem Subversion installation directory
set SVN_HOME = "C: \ Program Files \ VisualSVN Server"
Father rem all repository directory
set SVN_ROOT = D: \ Repositories
directory rem to back up
the SET BACKUP_SVN_ROOT = D: \ the Data \ Repositories
rem verification directory whether the repository, if it is the name of backup out
for / d %% in the I (% BACKUP_SVN_ROOT% \ *) do \ simpleRecover.bat "%% ~ fI" %% ~ nI.
GOTO End
: End
simpleRecover.bat file contents
echo Restoring ...... repository% 1
% SVN_HOME% \ bin \ svnadmin hotcopy% 1% SVN_ROOT% \% 2
echo repository% 1 successfully restored to the% SVN_ROOT% \% 2!