mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-16 17:51:28 +01:00
Updated count-lines.ps1
This commit is contained in:
parent
900809ed2d
commit
9ae69818cf
@ -2,11 +2,11 @@
|
||||
.SYNOPSIS
|
||||
Counts the number of lines
|
||||
.DESCRIPTION
|
||||
This PowerShell script counts the number of lines in text files (.c/.h/.cpp/.hpp/.java/.ps1/.txt/.md) within a directory tree.
|
||||
This PowerShell script counts the number of lines in text files (.txt/.md/.c/.h/.cpp/.hpp/.java/.py/.ps1/.bat) within a directory tree.
|
||||
.PARAMETER pathToDirTree
|
||||
Specifies the path to the directory tree.
|
||||
.EXAMPLE
|
||||
PS> ./count-lines.ps1 C:\cmake
|
||||
PS> ./count-lines.ps1 C:\Repos\cmake
|
||||
✔️ Found 639921 lines in 11411 text files within 📂cmake in 34 sec.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
@ -24,7 +24,7 @@ try {
|
||||
Write-Progress "Counting lines within $pathToDirTree ..."
|
||||
|
||||
[int64]$numFiles = [int64]$numLines = 0
|
||||
Get-ChildItem -Path $pathToDirTree -Include *.c,*.h,*.cpp,*.hpp,*.java,*.ps1,*.txt,*.md -Recurse | ForEach-Object {
|
||||
Get-ChildItem -Path $pathToDirTree -Include *.txt,*.md,*.c,*.h,*.cpp,*.hpp,*.java,*.py,*.ps1,*.bat -Recurse | ForEach-Object {
|
||||
$numLines += (Get-Content $_.FullName | Measure-Object -line).Lines
|
||||
$numFiles++
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ try {
|
||||
& "$PSScriptRoot/cd-repos.ps1"
|
||||
& "$PSScriptRoot/fetch-repos.ps1"
|
||||
" "
|
||||
& "$PSScriptRoot/play-big-ben.ps1"
|
||||
& "$PSScriptRoot/write-clock.ps1"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user