Skip to main content

Command Palette

Search for a command to run...

Powershell: Searching for Specific File Extensions

Updated
1 min read
P

SQL Server DBA | Powershell |TSQL | Azure

Searching for specific file extensions is a common task for many IT professionals and PowerShell provides a powerful solution. With just a few lines of code, you can quickly locate files with a specific extension in a given directory or even recursively across multiple folders. PowerShell's Get-ChildItem cmdlet combined with the -Filter parameter allows you to narrow down your search to a specific file extension, making it efficient and convenient. Whether you're looking for .txt, .csv, or any other file type, PowerShell empowers you to easily find and manage your files with precision and ease.

Syntax: Get-ChildItem -Path "C:\Path\To\Directory" -Filter "*.extension"

Get-ChildItem Get-ChildItem -Path "C:\users\Pradeep\Downloads" -Filter "*.png"

The above command will search for .PNG extension in folder c:\users\...