batch file to get line counts for multiple .csv and .txt files

You can use the code first posted here, in order to count the number of lines in a multiple text or .csv files in a folder.

Simply put this copy in a text file in the folder containing the source files. Change to the extension to .bat and double-click it.

@echo off cls setlocal EnableDelayedExpansion set /a total=0 ( for %%f in (*.txt) do ( for /f %%a in ('type "%%f"^|find /C /v "" ') do set /a total+=%%a&echo %%f %%a ) echo total !total! )>>list.txt


A new file named 'list.txt' will be generated showing the name of each source file and the number of lines in the file.

Confirmed the counts were correct in NotePad ++

Contact Me With Your Litigation Support Questions:

  • Twitter Long Shadow

© 2015 by Sean O'Shea . Proudly created with