Hi All,
I have this script :
param(
[string]$pattern,
[string]$path
)
$exclude = ("w:\test\york\SedAwk")
Get-ChildItem -path $path -Recurse -Filter *.html |
Where-Object{
ForEach-Object {
If (Get-Content $_.FullName | Select-String -Pattern "Stay Connected") {
Select-String -InputObject (Get-Content $_.FullName | Where {$_.FullName -notlike $exclude} | Out-String) -Pattern "(?sm)<main([\w\W]*)$pattern([\w\W]*)Stay Connected" -Quiet
}
ElseIf (Get-Content $_.FullName | Select-String -Pattern "Soyez branch") {
Select-String -InputObject (Get-Content $_.FullName | Where {$_.FullName -notlike $exclude} | Out-String) -Pattern "(?sm)<main([\w\W]*)$pattern([\w\W]*)Soyez branch" -Quiet
}
Else {
Select-String -InputObject (Get-Content $_.FullName | Where {$_.FullName -notlike $exclude} | Out-String) -Pattern "(?sm)<main([\w\W]*)$pattern([\w\W]*)" -Quiet
}
}
}
# call this script is using .\FindStringContent.ps1 -pattern "list-unstyled" -path "w:\path\path1" | Export-CSV "C:\test\savename4.csv"
But I am having a hard time getting it to exclude the SedAwk folder.
How can this be achieved?
Thanks