SVN checkout filtered by file extension?

后端 未结 6 1157
故里飘歌
故里飘歌 2020-12-09 10:35

I have a home-grown automated build script in the form of a DOS batch file. In part of that script, I check out (with \"svn checkout\") a section of our SVN repository that

6条回答
  •  星月不相逢
    2020-12-09 10:56

    For a powershell specific implementation of the answer from Michael Hackner, try something like:

    svn ls http://svn-server/src --recursive | Out-File svn.txt
    Get-Content .\svn.txt | where {$_.toLower().EndsWith('special.xml')} | select -First 200 | foreach {New-Object PSObject -Property @{ Path = $_; Munged = $_.Replace('/', '_') } } | foreach { svn export "http://svn-server/src/$($_.Path)" $($_.Munged) }
    

    My particular use case here is finding a bunch of similarly named files (in this case *special.xml) and dumping them all into a single folder, with essentially unique names. I have used an intermediate file to store the entire repo listing, but this could all be inlined as well if that's better for you.

提交回复
热议问题