Updated check-repos.ps1

This commit is contained in:
Markus Fleschutz 2024-05-02 15:36:41 +02:00
parent b612c905e2
commit 90ed5031d7

View File

@ -2,11 +2,15 @@
.SYNOPSIS .SYNOPSIS
Checks Git repositories Checks Git repositories
.DESCRIPTION .DESCRIPTION
This PowerShell script checks all Git repositories in a folder. This PowerShell script verifies the data integrity of all Git repositories in a folder.
.PARAMETER parentDir .PARAMETER parentDir
Specifies the file path to the parent folder Specifies the file path to the parent folder
.EXAMPLE .EXAMPLE
PS> ./check-repos.ps1 C:\Repos PS> ./check-repos.ps1 C:\Repos
Checking parent folder 📂C:\Repos... 16 subfolders
Checking 📂rust repository (1/16)...
...
Checked all 16 Git repos in 📂C:\Repos in 356s.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -25,15 +29,15 @@ try {
$numFolders = $folders.Count $numFolders = $folders.Count
"$numFolders subfolders" "$numFolders subfolders"
[int]$step = 2 [int]$step = 1
foreach ($folder in $folders) { foreach ($folder in $folders) {
"`n⏳ Checking repository 📂$folder ($step/$numFolders)..." "`n⏳ Checking 📂$folder repository ($step/$numFolders)..."
& "$PSScriptRoot/check-repo.ps1" "$folder" & "$PSScriptRoot/check-repo.ps1" "$folder"
$step++ $step++
} }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Checked $numFolders Git repos under 📂$parentDirName in $($elapsed)s." "✔️ Checked all $numFolders Git repos in 📂$parentDir in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"