Question

I am working on a php application and would like to know the number of lines in the files. The files are in a couple of different directories, but I can copy them all to one directory if needed.

What's the best Windows application/tool to count the number of lines in the files?

I've searched on here, but almost all of the questions were about counting in php, not using an external program.

Thank!

Was it helpful?

Solution

CLOC is an extremely powerful tool that does what your asking and separates lines of code, blank lines and comments.

OTHER TIPS

If you have access to a Linux shell, you can run this command:

find . -name '*.php' -exec cat {} \; | wc -l

If you're on Windows, install Cygwin first and then run the command.

If you don't want to use count(file($fn)) then external tools would also be feasible.

A standard Unix tool is wc wordcount. With the -l option just returns lines:

 $count = intval(`wc -l '$fn'`);

Don't forget escaping. And yes, you can google for a Windows version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top