count total number of lines in several files
Hi all,
I have a folder foo/ with many subfiles, subfolders and sub-subfiles/folders in it (a few hundred files and tens of folders), some that have code in them (.php, .html) and some miscalanious (gif, jpg, and so on). Is there an easy and quick way or script i can use to count the total ammount of lines of code in that folder ? Thanks. |
wc -l *
|
Err, thanks, but not exactly,
That only counts the total number of lines the directory i'm on.. but it doesnt go through all the subdirectories and files in there too.. |
"lines of code in that folder"...
anyway... if you want it to recurse, run it through find. find -type f -exec wc -l {} \; |
Code:
find -type f \( -iname "*.php" -o -iname "*.html" \) -exec wc -l {} \; | awk '{lines += $1 ; files += 1 ; print }; END { print "Lines total is: ", lines ," in ", files ," files"}' Something like this maybe? Cheers, Tink |
Quote:
Quote:
Quote:
Thanks all, |
All times are GMT -5. The time now is 04:18 AM. |