Subversion Hotcopy Backup Scripts

I wrote these two scripts to backup my repository at work. Tested on WinXP…

Example 1 – could be run with Scheduled Task:

@ECHO OFF
REM     will hotcopy your repo to My Documents
REM    this will delete the existing dir and create it again
REM    you could use this script with a scheduled task for backup

REM    created by Jim Priest
REM    last edited 3:38 PM 8/14/2006

SET REPODIR=d:\path-to-your-repository
SET REPOBACKUP="C:\path-to-your-backup\svnbackup"

ECHO ==================================
ECHO        PROCESSING BACKUP ...
ECHO  This may take some time depending
ECHO     on the size of your repository!
ECHO ==================================

RMDIR %REPOBACKUP% /S/Q
svnadmin hotcopy %REPODIR% %REPOBACKUP%

ECHO         BACKUP COMPLETED!

Example 2 – this one will copy the backup to a dated directory

@ECHO OFF
REM    will hotcopy your repo to My Documents into a dated directory
REM    created by Jim Priest
REM    last edited 3:45 PM 8/14/2006

REM     SET Date
for /f "tokens=1,2" %%u in ('date /t') do set d=%%v
for /f "tokens=1" %%u in ('time /t') do set t=%%u
if "%t:~1,1%"==":" set t=0%t%

SET timestr=%d:~6,4%-%d:~0,2%-%d:~3,2%
SET REPODIR=d:\path-to-your-repository
SET REPOBACKUP="C:\path-to-your-backup\svnbackup_%timestr%"

ECHO ==================================
ECHO        PROCESSING BACKUP ...
ECHO This may take some time depending
ECHO  on the size of your repository!
ECHO ==================================

svnadmin hotcopy %REPODIR% %REPOBACKUP%

ECHO         BACKUP COMPLETED!
ECHO ==================================
Recent Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>