public class CodeCount {
Vector files = new Vector();
int lines = 0;
public CodeCount() {
recurseDir("D:/Entwicklung/src");
System.out.println("FILES: " + files.size());
System.out.println("LINES: " + lines);
}
public static void main(String[] args) {
CodeCount codecount = new CodeCount();
}
public void recurseDir(String dirItem) {
try {
File file;
String list[];
file = new File(dirItem);
if (file.isDirectory()) {
list = file.list();
for (int i = 0; i < list.length; i++) {
recurseFrom(dirItem + File.separatorChar + list[i]);
}
} else {
if (dirItem.endsWith("java")) {
System.out.println(dirItem);
files.add(dirItem);
BufferedReader br = new BufferedReader(new
InputStreamReader(new FileInputStream(dirItem)));
String line = br.readLine();
while (line != null) {
lines++;
line = br.readLine();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}