The only dependencies of this script are :

  • "com.github.scala-incubator.io" %% "scala-io-core" % "0.4.2"
  • "com.github.scala-incubator.io" %% "scala-io-file" % "0.4.2"

scala-io provides really a great file operation abstraction layer for scala language.

On some of my projects, this script will print


$ time ./count-lines janalyse-*
----------------------------
All directories
global lines count : 9148 (in 101 files)
lines count for scala : 8875 (in 84 files)
lines count for sbt : 258 (in 14 files)
lines count for sh : 15 (in 3 files)
----------------------------
For directory : janalyse-jmx
global lines count : 1697 (in 21 files)
lines count for scala : 1607 (in 17 files)
lines count for sbt : 90 (in 4 files)
----------------------------
For directory : janalyse-ssh
global lines count : 3130 (in 34 files)
lines count for scala : 3064 (in 29 files)
lines count for sbt : 61 (in 4 files)
lines count for sh : 5 (in 1 files)
----------------------------
For directory : janalyse-snmp
global lines count : 342 (in 7 files)
lines count for scala : 308 (in 4 files)
lines count for sbt : 29 (in 2 files)
lines count for sh : 5 (in 1 files)
----------------------------
For directory : janalyse-series
global lines count : 3979 (in 39 files)
lines count for scala : 3896 (in 34 files)
lines count for sbt : 78 (in 4 files)
lines count for sh : 5 (in 1 files)

real 0m8.969s
user 0m14.058s
sys 0m0.819s