Have you ever been interested how many files your application consists of? Or how many lines have you and your developers have written in this app? Here is how to easily count them.
GNU
find, catandwccommands used below are installed on OS X and Linux by default. Although the ports to Windows do exist, I have not tested them because I do not have a Windows computer with Ext project. Hence, I welcome comments from Windows users very much.
Calculate number of files
This command descend to app, ux, overrides, sass and packages/mytheme directories to find JavaScript and Sass files.
If you have your sources in some additional directories just add them to the list, or remove theme directory from the list if you don't use a custom theme. Similarly, if you want to count, for example, PHP files, add them to the list of extensions in the regex expression: -regex '.*\.(js|scss|php)'
The file names are then piped (|) to wc command - which, by the way, stands for "word count", not for "water closet" - that with -l switch counts lines, in this case files.
The output is a single number giving you the number of files matching the find conditions. In one of the projects I've supervised recently it was 1047.
Calculate number of lines
It is very similar, we only need to concatenate the content of files before we pipe it to wc command. Thus:
Again, output is a single integer. In my case it was 146,206. Feel free to post your results in comments.



1 comment
Comments are closed on archived posts.