1.

Solve : how can i count number of lines of text files in one folder into one test file u?

Answer»

Dear All,

I just want to know, how can i count number of lines of text files in one folder into one test file using bat file.
I want to run bat fie. output like 
file name1.txt : 257 lines.
file name2.txt : 290 lines.

like thatDear All,

I just want to know, how can i count number of lines of text files using bat file.
I want to run that bat fie. in one particular folder output in a new text file like
file.txt
file name1.txt : 257 lines.
file name2.txt : 290 lines.

like that..
Please rpl asap.... Code: [Select]echo off
setlocal enabledelayedexpansion

:loop
  set /p folder="Enter Folder Name: "
  if not exist %folder% goto loop

pushd %folder% 

if exist %TEMP%\count.txt del %temp%\count.txt

for /F "tokens=* delims=" %%i in ('dir /b "%folder%"') do (
  for /f "delims=:" %%W in ('findstr /n /r ".*" "%%~dpnxi"') do set tot=%%w
    echo  "%%~nxi" : !tot! lines >> %temp%\count.txt


popd

You will be prompted for the folder name. The output file goes to %temp%\count.txt.

 There is an utility that does that. You can either make one or use one somebody else made. And you can easily do in in a batch.
You just want to count lines, - Right?



Discussion

No Comment Found