Sep
23

How to count total line of code in whole project/directory?

In many case you will require to count total number of line of code in your project.So here i am going to introduce with one powerful tool for counting line of code. That is CLOC .

  ABOUT TOOL :

CLOC is open source project.  CLOC  is written entirely in Perl language and CLOC is almost portable .

ClOC can works on

  • many flavors of Linux,
  • Mac OS X,
  • AIX,
  • Solaris, IRIX,
  • z/OS


CLOC counts blank lines, comment lines, and physical lines of source code in many programming languages.

BASIC USE :

just DOWNLOAD CLOC from here and put its binary anywhere in your machine.

Now open terminal go to in directory where your binary is kept.

type


prompt> cloc-1.53.pl   /path to your project directory

now you will find complete set of list showing various info of your project

like this

    4076 text files.
    3883 unique files.
    1521 files ignored.

http://cloc.sourceforge.net v 1.50  T=12.0 s (209.2 files/s, 70472.1 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Perl                          2052         110356         130018         292281
C                              135          18718          22862         140483
C/C++ Header                   147           7650          12093          44042
Bourne Shell                   116           3402           5789          36882
Lisp                             1            684           2242           7515
make                             7            498            473           2044
C++                             10            312            277           2000
XML                             26            231              0           1972
yacc                             2            128             97           1549
YAML                             2              2              0            489
DOS Batch                       11             85             50            322
HTML                             1             19              2             98
-------------------------------------------------------------------------------
SUM:                          2510         142085         173903         529677
-------------------------------------------------------------------------------

if yoy still not happy with this tool then you can find more such tool from following links
for same purpose.

 

JIGAR PATEL

hey I am an Artist who love to write code…! Well I am an EC graduate From Ganpat University and now i am working as Embedded software engineer in one private firm.. find me at here JigAr Patel

More PostsWebsiteTwitterFacebook

You may like to read this also....

2 Comments to “How to count total line of code in whole project/directory?”

  • Huzefa September 23, 2011 at 10:25 am

    Hi. Its a good tool and worked fine for mine project too.But can you just let me know which are the files it is ignoring in its calculation.

  • JIGAR PATEL September 23, 2011 at 10:41 am

    here it will consider only know language’s extension file others are ignoring. supported programming language you will find from

    http://cloc.sourceforge.net/#Languages

Post comment

*

CommentLuv badge
Follow us on Twitter! Follow us on Twitter!

Search in this website

our sponsors

latest comments

Find us on Facebook

Top Authors

35 posts
saurabh
22 posts
10 posts

Find us on stackoverflow

Polls

Tell us who you are

View Results

Loading ... Loading ...

My Bookmarks

Sponsers Link