ja1wyq
Last Updated: July 25, 2019
·
235
· 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.

1 Response
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
8 months ago ·