不需安裝、撰寫新程式
直接使用現成的工具
find . -name '*.php' | xargs wc -l
計算結果 類似:
1414 ./htdocs.www/chart/php/src/canvas/mxGdCanvas.php
189 ./htdocs.www/chart/php/src/canvas/mxHtmlCanvas.php
116 ./htdocs.www/chart/php/examples/deployment.php
230 ./htdocs.www/chart/php/examples/session.php
147 ./htdocs.www/chart/php/examples/embedimage.php
57 ./htdocs.www/chart/php/examples/graph.php
65 ./htdocs.www/chart/php/examples/fixedpoints.php
50 ./htdocs.www/chart/php/examples/reader.php
72 ./htdocs.www/chart/php/examples/server.php
76 ./htdocs.www/chart/php/test/mxCodecTest.php
28 ./htdocs.www/0client.php
110 ./htdocs.www/0code_test.php
95 ./htdocs.www/0ping.php
151284 total
參考
http://stackoverflow.com/questions/1358540/how-to-count-all-the-lines-of-code-in-a-directory-recursively