PowerShell: List Files
💡 TIP: Command names and parameter names are case-insensitive.
List Files and Directories
Get-ChildItemhas aliasdir
# list files in current dir dir # full path dir "c:/Program Files/Windows Defender" # relative path dir Documents # using home dir abbrev dir ~/Documents/ 
If path contain space, need quote.
Wildcard in Path
Path can contain Wildcards such as *.
# list files whose name ends in jpg in current dir dir *jpg 
LiteralPath
if you do not want special interpretation of path, use
-LiteralPath.
# list files in a dir whose name is just a asterisk dir -LiteralPath '*' 
Show Subdirectories (Recurse and Depth)
list files in current dir, and all subdirectories, any depth:
-recurse
dir -recurse 
-depth 0is same as no recurse.-depth 1means include children of first-level subdirectories.-depth 2means up to second-level subdirectories, etc.
dir -depth 1 
Show file name only (no dir path)
# list file names dir -recurse -name # result paths are relative to current dir 
Show Hidden Files and System Files
dir -Force 
Show Only Files (no dir)
dir -file 
Show Only Directories
# list only dirs dir -directory 
PowerShell. List Dirs and Files
List Dirs
- PowerShell: Navigate Directory
 - PowerShell: Show Current Dir Path
 - PowerShell: List Directories
 - Show Directory as Tree
 - PowerShell: List Empty Dir 📜
 - PowerShell: Dir Size 📜
 
List Files
- PowerShell: List Files
 - PowerShell: Show Fullpath, No Truncate Lines
 - PowerShell: List Empty Files
 - PowerShell: Count Number of Files
 - PowerShell: List Files by Wildcard Name Pattern
 - PowerShell: Filter File Name by Regular Expression
 - PowerShell: List File by Size
 - PowerShell: Sort Files by Size 📜
 - PowerShell: List Files by Date Time
 - PowerShell: Search Text in Files (grep)