Created
February 10, 2013 09:41
-
-
Save shiftkey/4748988 to your computer and use it in GitHub Desktop.
Sorting code files by line count using Powershell (because I want to tackle the simplest ones first)
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
$sortedFiles = @() | |
$files = Get-ChildItem D:\Code\github\shiftkey\UbiqRT-Storage\Storage\ -Filter *.cs -Recurse | |
ForEach($file in $files) { | |
$count = (Get-Content $file.FullName | Measure-Object).Count | |
if ($count -gt 0) { | |
$fullName = | |
$obj = New-Object System.Object | |
$obj | Add-Member -type NoteProperty -name Name -value $file.Name | |
$obj| Add-Member -type NoteProperty -name Count -value $count | |
$sortedFiles += $obj | |
} | |
} | |
$sortedFiles | Sort-Object Count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool! I found yours via Google, and then ended up writing my own that's easier to use and modify from the command line:
Tack on something like
… | Ft FullName, LineCount
to taste.