Skip to content

Instantly share code, notes, and snippets.

@aaronhoffman
Last active November 17, 2017 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronhoffman/416b88e64b970c4c9cb4 to your computer and use it in GitHub Desktop.
Save aaronhoffman/416b88e64b970c4c9cb4 to your computer and use it in GitHub Desktop.
PowerShell - List File Line Count For Files in a Directory that Match a Given Pattern
# List File Line Count For Files In A Directory That Match A Given Pattern
$path = "C:\path\"
$filter = "*match*.csv"
Write-Output $path
Write-Output $filter
$files = Get-ChildItem -Path $path -Filter $filter
$files | ForEach-Object {
# Write-Output $_.FullName
Get-Content -Path ($path + $_) | Measure-Object -Line | Select-Object -ExpandProperty Lines | Write-Output
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment