Skip to content

Check-Repos

Checks Git repositories

param([string]$parentDir = "$PWD")

try {
	$stopWatch = [system.diagnostics.stopwatch]::startNew()

	$parentDirName = (Get-Item "$parentDir").Name
	Write-Host "? Checking parent folder ??$parentDir...       " -noNewline
	if (-not(Test-Path "$parentDir" -pathType container)) { throw "Can't access folder: $parentDir" }
	$folders = (Get-ChildItem "$parentDir" -attributes Directory)
	$numFolders = $folders.Count
	"$numFolders subfolders"

	[int]$step = 1
	foreach ($folder in $folders) {
		"`n? Checking repo '$folder' ($step/$numFolders)..."
		& "$PSScriptRoot/check-repo.ps1" "$folder"
		$step++
	}

	[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
	"? $numFolders Git repos checked at ??$parentDir in $($elapsed)s."
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

Specifies the file path to the parent folder

An interactive directory of PowerShell scripts.