Last active
August 23, 2019 19:30
-
-
Save jrich523/77aae37d970bbdaa0e2405d956ff5ee6 to your computer and use it in GitHub Desktop.
Find all projects within a folder (recursive)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find-Projects { | |
param( | |
$root='D:\Repos', | |
$depth = 5) | |
$projectTypes = @(".git",".vscode") | |
## is this folder a project? | |
if(ls $root -Directory -Name -Force | ? { $projectTypes -contains $_}) | |
{ | |
return $root | |
} | |
if($depth -gt 0){ | |
$folders = ls -Path $root -Directory | |
foreach($folder in $folders) | |
{ | |
find-Projects $folder.fullname $depth-1 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment