Advertisement
drkbl

Backup all SVN repositories

Aug 16th, 2015
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.12 KB | None | 0 0
  1. @echo off
  2.  
  3. echo Backup all SVN repositories using Hungarian date format
  4. echo
  5. echo Based on http://serverfault.com/a/573221/305124
  6. echo To auto-elevate only this script,
  7. echo use http://www.nirsoft.net/utils/nircmd2.html nircmd elevate
  8.  
  9. set svnAdminPath="C:\Program Files\VisualSVN Server\bin"
  10. set sevenZipPath="C:\Program Files\7-Zip"
  11. set repositoryRoot=c:\Users\DBA\Documents\Repositories
  12. set backupPath=c:\Users\DBA\Documents\Backup
  13. set dateStamp=%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%
  14.  
  15. for /f %%f in ('dir /b /AD %%repositoryRoot%%') do (
  16. call:dumpRepository %%f
  17. call:zipLastDump
  18. )
  19. goto:eof
  20.  
  21. :dumpRepository
  22. cd /d %svnAdminPath%
  23. set repoPath=%repositoryRoot%/%~1
  24. set dumpFile=%~1_%dateStamp%
  25. echo.-------------------
  26. echo.Dumping %~1 to %dumpFile%.dump
  27. echo.-------------------
  28. svnadmin dump "%repoPath%" > "%backupPath%\%dumpFile%.dump"
  29. exit /b
  30.  
  31. :zipLastDump
  32. cd /d %sevenZipPath%
  33. set zipFile="%backupPath%\%dumpFile%.7z"
  34. echo.-------------------
  35. echo.Zipping %dumpFile%.dump to %zipFile%
  36. echo.-------------------
  37. 7z a "%zipFile%" "%backupPath%\%dumpFile%.dump"
  38. del "%backupPath%\%dumpFile%.dump"
  39. exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement