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
Checks Git repositories
.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
Specifies the file path to the parent folder
.EXAMPLE
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
https://github.com/fleschutz/PowerShell
.NOTES
@ -25,15 +29,15 @@ try {
$numFolders = $folders.Count
"$numFolders subfolders"
[int]$step = 2
[int]$step = 1
foreach ($folder in $folders) {
"`n⏳ Checking repository 📂$folder ($step/$numFolders)..."
"`n⏳ Checking 📂$folder repository ($step/$numFolders)..."
& "$PSScriptRoot/check-repo.ps1" "$folder"
$step++
}
[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
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"