Monday, 3 December 2018

Top 10 source code files by line count

What are the top 10 source code files (by number of lines)?

gci -Recurse *.cs -ErrorAction SilentlyContinue | % { $file = $_; Get-Content $_ | Measure-Object -Line | Add-Member File $_ -PassThru } | Sort-Object -Descending -Property Lines | Select-Object -First 10 -Property File, Lines

Note the use of Add-Member to capture the filename so we can display it in the output

No comments: