PowerShell: List Files by Wildcard Name Pattern
Filter File Name by Wildcard (-filter)
-filter parameter takes a
Wildcards pattern to show only those files.
Useful if you want to list files of a specific filename extension.
You cannot use the filter parameter to filter multiple filename extensions.
# list jpg files dir -recurse -file -filter *.jpg 
# list emacs backup files (file name ending in ~) dir -recurse -file -filter *~ 
Filter File Name by Multiple File Extensions
You can use
-include or -exclude
with Wildcards
to filter out files by multiple file name extensions.
e.g.
-include *.jpg,*.png
the Exclude parameter is applied after the Include parameter.
- 🛑 WARNING: when you use 
-includeor-exclude, you must list by dir content, e.g.dir *or with-recurse - 💡 TIP: 
-includeor-excludeis MUCH slower than using-filter 
-include
dir -recurse -file -include *.jpg,*.jpeg # or dir -recurse -file -include "*.jpg","*.jpeg" 
-exclude
dir -recurse -file -exclude *.jpg,*.jpeg 
Filter File Name by Regular Expression
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)