Piping data on Windows command prompt

后端 未结 2 362
情歌与酒
情歌与酒 2020-12-16 17:36

I need to get a backup dump of a large (~8gb) svn repository. My current method involves using svnadmin dump to a file and then using 7-Zip to compress and spli

相关标签:
2条回答
  • 2020-12-16 18:23

    svnadmin dump dumps to standard out by default and the 7z command line can read from standard input using the -si switch.

    svnadmin dump c:\path\to\myrepo | 7z a -si svndump.7z
    
    0 讨论(0)
  • 2020-12-16 18:28

    Because your sample was exactly what I was looking for, this is what I did as a complete solution to "dump" all my repositories. That solution dump all svn repositories to 7-zip file without uncompressed intermediate.

    Put that batch file in your "repository root", e.g. m:\repositories\dump-all.bat

    pushd %~dp0
    SET SEVENZIP="c:\Program Files\7-Zip\7z.exe" a -mx1 -si 
    FOR /f "tokens=*" %%i in ('DIR /a:d /b') DO svnadmin dump %%i | %SEVENZIP% ..\_svndump\%%i.dump.7z
    

    And, start that batch like this if you need to run it in low priority, both process (7z + svnadmin) will take a lot of cpu

    start /low m:\repositories\dump-all.bat
    

    Notes: "pushd %~dp0" set the "current directory" to where the batch file is, instead of starting it in "c:\windows\system32" if you start it from explorer with "run as administrator". It also works if the working folder is on another drive.
    No need to type "m:" and "cd \repositories". if you start it from "c:" drive.

    0 讨论(0)
提交回复
热议问题