Hi
I have a folder structure such as
Top
- Sub
- Sub
-
- SubSub
- Sub
-
- SubSub
-
-
- SubSubSub
I need to be able to count just the SubSub folders, ignoring the Sub folders.
- SubSubSub
-
I could count everything the 1st, 2nd and 3rd level sub folders ($sub) and subtract the 1st level ($top) by using:
$top = (Get-ChildItem -Path "C:\Program Files" | Measure-Object).Count $sub = (Get-ChildItem -Path "C:\Program Files" -Recurse | Measure-Object).Count $tot = $sub - $top
but how would I ignore the 3rd level sub folders?