mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-23 18:38:19 +02:00
Updated check-repo.ps1 and check-repos.ps1
This commit is contained in:
parent
4be557732e
commit
b612c905e2
@ -71,7 +71,7 @@ try {
|
|||||||
|
|
||||||
$repoDirName = (Get-Item "$FullPath").Name
|
$repoDirName = (Get-Item "$FullPath").Name
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Checked 📂$repoDirName repository in $elapsed sec"
|
"✔️ Checked repo 📂$repoDirName 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])"
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script checks all Git repositories in a folder.
|
This PowerShell script checks all Git repositories in a folder.
|
||||||
.PARAMETER parentDir
|
.PARAMETER parentDir
|
||||||
Specifies the path to the parent folder
|
Specifies the file path to the parent folder
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-repos.ps1 C:\MyRepos
|
PS> ./check-repos.ps1 C:\Repos
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -19,20 +19,21 @@ try {
|
|||||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
$parentDirName = (Get-Item "$parentDir").Name
|
$parentDirName = (Get-Item "$parentDir").Name
|
||||||
"⏳ Step 1 - Checking parent folder 📂$parentDirName..."
|
Write-Host "⏳ Checking parent folder 📂$parentDir... " -noNewline
|
||||||
if (-not(Test-Path "$parentDir" -pathType container)) { throw "Can't access folder: $parentDir" }
|
if (-not(Test-Path "$parentDir" -pathType container)) { throw "Can't access folder: $parentDir" }
|
||||||
$folders = (Get-ChildItem "$parentDir" -attributes Directory)
|
$folders = (Get-ChildItem "$parentDir" -attributes Directory)
|
||||||
$numFolders = $folders.Count
|
$numFolders = $folders.Count
|
||||||
"Found $numFolders subfolders."
|
"$numFolders subfolders"
|
||||||
|
|
||||||
[int]$Step = 1
|
[int]$step = 2
|
||||||
foreach ($folder in $folders) {
|
foreach ($folder in $folders) {
|
||||||
|
"`n⏳ Checking repository 📂$folder ($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 at 📂$parentDirName in $elapsed sec"
|
"✔️ Checked $numFolders Git repos under 📂$parentDirName 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])"
|
||||||
|
Loading…
Reference in New Issue
Block a user