Skip to content

Instantly share code, notes, and snippets.

View al1gned's full-sized avatar
😥
clueless

Souvik al1gned

😥
clueless
View GitHub Profile
@al1gned
al1gned / count.ps1
Last active September 17, 2023 12:44
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
}
@al1gned
al1gned / count.ps1
Created June 13, 2023 11:19
blah blah
$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