Skip to content

Instantly share code, notes, and snippets.

@starlightsys
Created July 18, 2017 11:00
Show Gist options
  • Save starlightsys/1962e083188d1dd84e27762a174c67e6 to your computer and use it in GitHub Desktop.
Save starlightsys/1962e083188d1dd84e27762a174c67e6 to your computer and use it in GitHub Desktop.
[CmdletBinding()]
param (
[Parameter(Mandatory=$True)]
[string]$grep_pattern,
[Parameter(Mandatory=$True)]
[string]$glob_pattern,
[Parameter(Mandatory=$False)]
[string]$path
)
If (Test-Path variable:local:path) {
$files = Get-ChildItem -Path $path -Include $glob_pattern -Recurse
} else {
$files = Get-ChildItem -Include $glob_pattern -Recurse
}
$files | Select-String $grep_pattern -CaseSensitive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment