ja1wyq
Last Updated: March 04, 2019
·
148
· whatishedoing

PowerShell Recursive Search

A little snippet I use often: finding specific text within a large folder hierarchy, omitting files I know aren't of use:

Get-ChildItem *.cs -Exclude *Test*.cs -Recurse | Select-String "something" -SimpleMatch

Appending | Group Path | Select Name will further filter that list to just the files that contain the required text.

2 Responses
Add your response

31402

Loving the ability to further augment search with pipes. Here, I can (roughly) find all unique icons in alphabetical order:

Get-ChildItem -Include ('*.html', '*.ts') -Recurse | Select-String "['""]+.*(icon-[a-zA-Z\-]+)" | % { $_.Matches.Groups[1].Value } | Select-Object -Unique | Sort-Object
3 months ago ·
32031

I am very happy to read this. Appreciate your sharing
http://strikeforceheroes3.games

11 days ago ·