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.
Written by Darren Hickling
Related protips
1 Response
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
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Powershell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#