Created
April 28, 2016 12:48
-
-
Save stofte/77d808420c5bcfbfc5e79f0531f37504 to your computer and use it in GitHub Desktop.
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
$counts = @{".cs"=0;".js"=0;".xml"=0;".config"=0} | |
$excludeList = @() | |
Get-ChildItem -Recurse | % { | |
$pathParts = $_.FullName.substring($pwd.path.Length + 1).split("\"); | |
if ( ! ($excludeList | where { $pathParts -like $_ } ) ) { $_ } | |
} | | |
where { $_.FullName -ne $_.Directory -and $_.Extension -ne $null } | | |
foreach-object -process { | |
try { | |
if ($counts.ContainsKey($_.Extension)) { | |
[int]$curr = [int]$counts.Get_Item($_.Extension); | |
$add = [int]::Parse(([regex]'^\W*(\d+)').match((C:\bin\wc.exe -l $_.FullName)).groups[1].value); | |
[console]::writeline("{0}:{1}+{2}", $_.FullName, $curr, $add) | |
$counts.Set_Item($_.Extension, $curr + $add) | |
} | |
} catch { | |
Write-Error $_.Exception.Message | |
} | |
} | |
$counts | format-list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment