On 6/15/07, Toni Torello <toni.torello@xxxxxxxxx> wrote:
hi guys, just supposing... which is the right way to to count the number of code lines in a php application? do you think that the raw: $ find . -name '*.php' -exec cat {} \; | wc -l can be a good estimate?
I recently desired to know a similar estimate of the project I was working on and came up with essentially the same thing, but automated it slightly further to encompass other file types also, this is the (perl) script I came up with for your interest: #!/usr/bin/perl -w my @types = qw(php css xml xhtml html js sql); foreach my $type (@types) { print "Lines in files of type: \t" . $type . ": "; my $command = "find . -name *.$type -type f -exec cat {} + | wc -l"; print `$command`; } Not perfect but it's not bad. Keep in mind it wont see what is a comment and what isnt for example.. Cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php