commit a144ffc6e1a61c3fef5bf91be1988cb9ecb1b4f1 Author: Claudiu Farcas Date: Tue Jan 17 21:07:29 2017 +0200 Init commit Extremely needed script used to find and centralise git repos spread inside my dev machine! diff --git a/Git/FindGitRepos.ps1 b/Git/FindGitRepos.ps1 new file mode 100644 index 0000000..b2e0db8 --- /dev/null +++ b/Git/FindGitRepos.ps1 @@ -0,0 +1,38 @@ +Function GetGitRepos { +<# + +usage: + '. .\FindGitRepos.ps1; GetGitRepos ' + '. .\FindGitRepos.ps1; GetGitRepos' +arguments: + if is missing it will be considered current script folder + +remarks: + I needed this script to find and centralise all git repos stored on my machine. + Now I have them all under control! + You can have them too! + +#> + + Write-Host "------------------------------------------" + if($args[0]){ + $path = $args[0] + "*" + Write-Host "Search git repos in '$path'" + $Files = Get-ChildItem . -Path $path -Attributes Directory,Directory+Hidden -ErrorAction SilentlyContinue -Include ".git" -Recurse + } + else { + $path = $PSScriptRoot + "*" + Write-Host "Search git repos in local '$path'" + $Files = Get-ChildItem . -Attributes Directory,Directory+Hidden -ErrorAction SilentlyContinue -Include ".git" -Recurse + } + Write-Host "------------------------------------------" + if($Files.Count>0){ + foreach ($File in $Files) { + write-host $($File) + } + } + else{ + Write-Host "No git repos found" + } + Write-Host "------------------------------------------" +} \ No newline at end of file