Hi I want to count number of lines in csv files in a folder and display it,

I have the code to count number of lines,but the problem is i want to loop all the files in that folder and display it ,

For eg: in Month January folder ,I have files with file names week1,week2,week3,week4

I want to display the the number of lines in january folder ie. number of lines in week1+number of lines in week2+number of lines in week3+number of lines in week4.

I it possible.

The code to count number of lines in a single file is

<?php

$linecount = count(file("Desktop/countries.csv"));
echo $linecount;
?>


Thanks

for i in `ls`
do
LC='wc -l ${i} | cut -d\ -f1`
let COUNT=${COUNT}+${LC}
done
echo ${COUNT}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.