Created
February 23, 2011 23:35
-
-
Save zippy1981/841433 to your computer and use it in GitHub Desktop.
Using powershell to list particular files in svn.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName "System.Web" | |
# Powershell function to iterate through all the branches of a | |
# Visual Studio Solution in SVN, and return the file names in particular subfolders of the database project | |
# Assumes the command line svn client is in the system path | |
function Get-ReleaseScripts ( | |
[string] $branchRoot, | |
[string] $subProject, | |
[string[]] $scriptFolders = ('Ad Hoc Scripts', 'Release Scripts') | |
) { | |
[string[]] $branches = svn ls $branchRoot; | |
foreach ($branch in $branches) { | |
[string] $branchPath = $branchRoot + '/' + $branch + $subProject; | |
foreach ($scriptFolder in $scriptFolders) { | |
[string] $scriptPath = $branchPath + [Web.HttpUtility]::UrlPathEncode($scriptFolder); | |
[string[]] $scriptFiles = svn ls $scriptPath 2> $null; | |
"`t$scriptFolder/"; | |
if ($scriptFiles.length -gt 0) { | |
foreach ($file in $scriptFiles) { "`t`t$file" } | |
"`t`t- $($scriptFiles.length) files"; | |
} else { | |
"`t`tNo scripts found" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment