Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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