Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: List all subfolders under a target path with PowerShell

$
0
0

Summary: Use Get-Childitem to provide a printable list of all folders under a path.

Hey, Scripting Guy! Question I used to use tree.com to get a list of folders on a computer. Is there something close to that in PowerShell? Maybe something I could print?

Hey, Scripting Guy! Answer If you were to use Get-Childitem combined with Select-Object, you could get a pretty clean list. Here’s an example that targets drive c: and all hidden folders. It displays only directories and their full paths.

Get-ChildItem -Path C:\ -Recurse -Directory -Force -ErrorAction SilentlyContinue | Select-Object FullName

The Doctor


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>