Created
February 7, 2018 17:45
-
-
Save sodejm/0b5fdd1fd00a7e1a0f9cfa1e73b97e9f to your computer and use it in GitHub Desktop.
Basic Powershell script to count lines of code, this probably isn't 100% accurate but works for my basic purposes
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
# .\countLOC.ps1 -path "C:\code\MyProject" -outputFile "C:\code\loc.csv" -include "*.cs" -exclude "*.designer.cs" | |
param([string]$path, [string]$outputFile, [string]$include = "*.*", [string]$exclude = "") | |
Clear-Host | |
Get-ChildItem -re -in $include -ex $exclude $path | | |
Foreach-Object { Write-Host "Counting $_.FullName" | |
$fileStats = Get-Content $_.FullName | Measure-Object -line | |
$linesInFile = $fileStats.Lines | |
"$_,$linesInFile" } | Out-File $outputFile -encoding "UTF8" | |
Write-Host "Complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment