top of page

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

GOTO :EOF

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 ++


Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

​

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

​

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page