4 ms·
I would love a PowerShell example that finds files in a directory tree matching a file name pattern, filters those files to those that contain a specific string
by atwood22 4y ago
I would love a PowerShell example that finds files in a directory tree matching a file name pattern, filters those files to those that contain a specific string in their contents, and then prints the filenames to a single output file.
- majkinetor 4y agoIn the root dir: ls -Recurse glob | ? { (gc $_ -Raw) -match pattern } | Out-File result.log Not tested, typed on phone before bad half a sleep.