• Wincent
    Menu
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search

Getting the count of lines in a subdirectoryEdit

Created 5/29/2014, updated 5/18/2017

Example: cumulative total:

$ find . -type f -exec cat {} + | wc -l

Example: per file counts and total:

$ find . -regex '.+\.js$' | xargs wc -l

Source

  • http://stackoverflow.com/questions/13727917/use-wc-on-all-subdirectories-to-count-the-sum-of-lines
  • http://stackoverflow.com/questions/104756/how-do-you-count-your-lines-of-code

Alternatives

  • http://cloc.sourceforge.net/ (Perl tool for counting source code)
  • wiki
Site
  • About
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search
External
  • GitHub
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
Colophon

Made by Greg Hurrell with Rust (with help from Git and Neovim).