I don't claim to have any experience with *nix command line flavors. My command line experience is limited to several versions of MS-DOS back in the day. Luckily, that's where Google comes in handy.
After trying lots of different things, I landed on the following bash command. Open Terminal on your Mac and navigate to your project's root directory. (Handy trick: type cd with a space after it, then drag the root folder into Terminal, and it'll automatically paste in the entire path).
find . -name "*.[hm]" -print0 | xargs -0 wc -lYou'll get a list of every .h and .m file in your project (searching subdirectories recursively), with how many lines are in each file. Finally, you'll get a total line count for all files.
Note that this counts all lines, even blank lines and comments.
1 comment:
Thanks, this was just what I needed. I appended "| sort" to the command string to sort the results by line count.
Post a Comment