Inspect filesystem contents and produce usable lists of files and folders.

Sheet: 01 of 25 | Platform: Windows 10/11 | Shell: PowerShell 7.x and Windows PowerShell 5.1 (unless marked otherwise) | Editorial review: November 24, 2026

PowerShell cheat sheet index

Examples use the MGU project root and illustrative staging, backup, and download paths. Replace them with existing, approved paths as needed. Unless explicitly marked as a continuation, examples are independent. Read commands before running them; commands that write or modify files can change existing data.

Quick commands

1. List immediate children

Get-ChildItem -LiteralPath 'C:\MGU'

2. List all files recursively

Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File

3. List directories only

Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -Directory

4. Include hidden items

Get-ChildItem -LiteralPath 'C:\MGU' -Force

5. List HTML files with provider-side filtering

Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File -Filter '*.html'

6. Return full paths as strings

Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
    Select-Object -ExpandProperty FullName

7. Sort immediate children by name

Get-ChildItem -LiteralPath 'C:\MGU' | Sort-Object Name

Operational notes

-Recurse traverses descendants; -File and -Directory limit item types. -Force includes hidden items but does not bypass permissions. Review enumeration errors before treating an inventory as complete.

Official documentation