Created
January 24, 2019 20:10
-
-
Save petesql/b09b9eb406ad6ebfe0c8feb9994f9943 to your computer and use it in GitHub Desktop.
count_rows_within_csv_files
This file contains 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 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
Blog Post containing an example of using this script >
Count Rows within CSV Files using PowerShell
https://peter-whyte.com/count-rows-within-csv-files-using-powershell/