Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- echo Backup all SVN repositories using Hungarian date format
- echo
- echo Based on http://serverfault.com/a/573221/305124
- echo To auto-elevate only this script,
- echo use http://www.nirsoft.net/utils/nircmd2.html nircmd elevate
- set svnAdminPath="C:\Program Files\VisualSVN Server\bin"
- set sevenZipPath="C:\Program Files\7-Zip"
- set repositoryRoot=c:\Users\DBA\Documents\Repositories
- set backupPath=c:\Users\DBA\Documents\Backup
- set dateStamp=%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%
- for /f %%f in ('dir /b /AD %%repositoryRoot%%') do (
- call:dumpRepository %%f
- call:zipLastDump
- )
- goto:eof
- :dumpRepository
- cd /d %svnAdminPath%
- set repoPath=%repositoryRoot%/%~1
- set dumpFile=%~1_%dateStamp%
- echo.-------------------
- echo.Dumping %~1 to %dumpFile%.dump
- echo.-------------------
- svnadmin dump "%repoPath%" > "%backupPath%\%dumpFile%.dump"
- exit /b
- :zipLastDump
- cd /d %sevenZipPath%
- set zipFile="%backupPath%\%dumpFile%.7z"
- echo.-------------------
- echo.Zipping %dumpFile%.dump to %zipFile%
- echo.-------------------
- 7z a "%zipFile%" "%backupPath%\%dumpFile%.dump"
- del "%backupPath%\%dumpFile%.dump"
- exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement