Command library / Get-ChildItem
Get-ChildItem
List files and folders as objects
PowerShell's directory listing — but every result is a real object (with properties like Length and LastWriteTime), not text to be parsed. The path binds positionally; -Recurse walks into subfolders; -Force also shows hidden and system items.
Practice Get-ChildItemUsage
Options and flags
-PathPATHdirectory to list (first positional parameter)
-Recursedescend into every subdirectory
-FilterPATTERNfast, provider-side name filter, e.g. *.log
-Forcealso show hidden and system items
Examples
Get-ChildItem C:\UsersList everything directly inside C:\Users — the path binds positionally.
Get-ChildItem -Path C:\Logs -RecurseEvery file in C:\Logs and all of its subfolders.
Get-ChildItem -Filter *.log -RecurseOnly .log files, searched recursively from the current directory.
Get-ChildItem -ForceInclude hidden and system files that a plain listing would skip.
Common mistakes
-Filter takes a wildcard pattern, not a bare word — 'log' with no * only matches an item named exactly 'log'.