 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to search for a specific extension using Get-ChildItem in PowerShell?
To get the output of the get-childitem with a specific extension, we need to use –includeparameter.
Example
In the below example, we will use the below script to get only .xml files.
Get-ChildItem D:\Temp\ -Recurse -Include *.xml
Output
PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Include *.xml     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       24-11-2018     11:34           6215 Backup.xml -a----       24-11-2018     11:34            602 Bkupinfo.xml     Directory: D:\Temp Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       07-05-2018     23:00            301 cars.xml You can filter multiple extensions with include parameter and for that, you need to add a comma (,) between extensions.
Example
For example, we will get the output here with file extensions xml and csv.
Get-ChildItem D:\Temp\ -Recurse -Include *.xml, *.csv
Output
PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Include *.xml, *.csv     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9}\DomainSysvol\GPO\Machine\microsoft\windows     nt\Audit Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       24-11-2018     11:34           6234 audit.csv     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       24-11-2018     11:34           6215 Backup.xml -a----       24-11-2018     11:34            602 Bkupinfo.xml     Directory: D:\Temp Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       07-05-2018     23:00            301 cars.xml -a----       25-10-2017     08:13            104 testcsv.csvAdvertisements
 