Instantly share code, notes, and snippets.

Embed
What would you like to do?
count_rows_within_csv_files
# Count rows within CSV files, in a specified directory.
Get-ChildItem "C:\myfolder\" -re -in "*.csv" |
Foreach-Object {
$fileStats = Get-Content $_.FullName | Measure-Object -line
$linesInFile = $fileStats.Lines -1
Write-Host "$_,$linesInFile"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment