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:

CODE:
  1. @ECHO OFF
  2. REM     will hotcopy your repo to My Documents
  3. REM    this will delete the existing dir and create it again
  4. REM    you could use this script with a scheduled task for backup
  5.  
  6. REM    created by Jim Priest
  7. REM    last edited 3:38 PM 8/14/2006
  8.  
  9. SET REPODIR=d:\path-to-your-repository
  10. SET REPOBACKUP="C:\path-to-your-backup\svnbackup"
  11.  
  12. ECHO ==================================
  13. ECHO        PROCESSING BACKUP ...
  14. ECHO  This may take some time depending
  15. ECHO     on the size of your repository!
  16. ECHO ==================================
  17.  
  18. RMDIR %REPOBACKUP% /S/Q
  19. svnadmin hotcopy %REPODIR% %REPOBACKUP%
  20.  
  21. ECHO         BACKUP COMPLETED!

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

CODE:
  1. @ECHO OFF
  2. REM    will hotcopy your repo to My Documents into a dated directory
  3. REM    created by Jim Priest
  4. REM    last edited 3:45 PM 8/14/2006
  5.  
  6. REM     SET Date
  7. for /f "tokens=1,2" %%u in ('date /t') do set d=%%v
  8. for /f "tokens=1" %%u in ('time /t') do set t=%%u
  9. if "%t:~1,1%"==":" set t=0%t%
  10.  
  11. SET timestr=%d:~6,4%-%d:~0,2%-%d:~3,2%
  12. SET REPODIR=d:\path-to-your-repository
  13. SET REPOBACKUP="C:\path-to-your-backup\svnbackup_%timestr%"
  14.  
  15. ECHO ==================================
  16. ECHO        PROCESSING BACKUP ...
  17. ECHO This may take some time depending
  18. ECHO  on the size of your repository!
  19. ECHO ==================================
  20.  
  21. svnadmin hotcopy %REPODIR% %REPOBACKUP%
  22.  
  23. ECHO         BACKUP COMPLETED!
  24. ECHO ==================================

Creative Commons License

Copyright © 2007 thecrumb.com. All rights reserved.