Created
June 13, 2023 11:19
-
-
Save dalsvk/c95cae777ba37c5dff4febac6039e44a to your computer and use it in GitHub Desktop.
blah blah
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$folderPath = Get-Location | |
$searchStrings = @("</div>", "</h5>", "</h1>", "</a>", "</p>", "</table>", "</td>", "</tr>", "</th>", "<br>", "<img", "</address>") | |
Get-ChildItem -Path $folderPath -File -Recurse | Where-Object { $_.Extension -eq ".html" } | ForEach-Object { | |
$fileName = $_.Name | |
$fileCounts = @{} | |
$content = Get-Content -Path $_.FullName -Raw | |
foreach ($searchString in $searchStrings) { | |
$occurrences = ($content | Select-String -Pattern $searchString -AllMatches).Matches.Count | |
$fileCounts[$searchString] = $occurrences | |
} | |
Write-Output "File: $fileName" | |
foreach ($searchString in $searchStrings) { | |
if ($fileCounts.ContainsKey($searchString)) { | |
Write-Output "$searchString : $($fileCounts[$searchString])" | |
} | |
} | |
Write-Output "`n" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment