Last active
March 12, 2018 14:33
-
-
Save harmoniemand/bb53396b45ad7ebc070d to your computer and use it in GitHub Desktop.
Powershell count lines of code
This file contains hidden or 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
# Count Lines | |
(dir -include *.cs -recurse | select-string "^(\s*)//" -notMatch | select-string "^(\s*)$" -notMatch).Count | |
# Search String | |
$search = "focusSearchInputfield"; | |
Get-ChildItem -Recurse | Where { ! $_.PSIsContainer } | Select-String $search | select LineNumber, Path, Filename |Format-List | |
(dir -include * -recurse | select-string "_recurse") | |
# Count all Files | |
(dir -include * -recurse).Count | |
# Count all files exclude pattern | |
(Get-ChildItem -Recurse | Where {$_.FullName -notlike "*\node_modules\*"} | select-string "^(\s*)//" -notMatch | select-string "^(\s*)$" -notMatch).Count | |
# get all filenames as strings in a text-file | |
get-childitem -recurse | where { ! $_.PSIsContainer } | % { | |
$_.FullName | Out-File test.txt -Append | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment