You are viewing knowbody

Thu, Feb. 4th, 2010, 12:11 pm
Poor Man's PowerShell Linecount Tool

This obviously doesn't account for empty lines, comments, etc., but it works:)

function get-numlines($filter) {
    $num_lines = 0
    ls -recurse -filter $filter |% {gc $_.FullName | measure-object} | % {$num_lines+=$_.Count}
    return $num_lines
}

get-numlines *.py