Find all file extensions in a folder on Windows 10 using PowerShell

Published on Author JFLeave a comment

Notepad++ is a terrific, free alternative to NotePad and it is multipurpose. I love the tabbed interface and, especially, not having to save every tab on close.

What you can’t do in Search in Files is easily filter out file extensions to search (well, actually, there’s a good chance you can create your own function to do that). You can only limit file extensions with inclusions.

*.php will search in only .php files, for example.

You can add more extensions delimited with a space or a semi-colon:

*.php;*.ini

While searching for a solution I came across this on StackOverflow:

In a nutshell, copy and paste this (make sure to change the path) into PowerShell.

("*" + ((Get-ChildItem -File -recurse "C:\folder\folder" | Where {$_.Extension -ne ""}| Select-Object Extension -unique | Sort-Object Extension | Get-Unique -asString | Select -ExpandProperty Extension | % { $_.ToLower() } | Get-Unique) -join ";*"))

This will output a semi-colon delimited list of file extension you can edit and copy/paste into the NotePad++ filter section.

Or add

> file-extensions.txt

at the end to port it to a text file.

Another item in that thread is grepWin. If I was allowed to install it I would.

Hope this helps and props to the original StackOverflow thread.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.