PowerShell: List Directories

By Xah Lee. Date: . Last updated: .

Command names and parameter names are case-insensitive.

List Directory Only

List directories only (no file) of current directory:

dir -Directory -Recurse

Show just path (relative to current dir):

dir -Directory -Recurse -name

Show full path path:

dir -Directory -Recurse | ForEach-Object { $_.fullname }

Show Directory as Tree

This is a command at C:/Windows/system32/tree.com

# show dir as tree, dir only
# show dir as tree, include files
tree /f

sample output:

│   ├───chromium
│   └───firefox
│   ├───description
│   ├───img
│   └───screenshots

PowerShell, Working with Directory

PowerShell How-To

Install and Help

list files

list dirs

on dir

on file

Windows config

zip tar