Recently needed to count the total number of lines of code in the project, wrote a Python applet, I have to say Python is how concise, if you use Java to write at least 2 times the current code.
[code]
import os
path="/Users/rony/workspace/ecommerce/ecommerce/hot-deploy/"
global totalcount
totalcount =0
def cfile (path):
allfiles = (path)
for file in allfiles:
child = (path,file)
if (child):
cfile(child)
else:
filename,fileext= (child)
print(fileext)
#file type need to calculate
if fileext in ['.java', '.jsp', '.html', '.htm', '.xml', '.sql', '.js', '.ftl', '.css','.groovy'] :
countf = len(open(child,'rU').readlines())
global totalcount
totalcount=totalcount+countf;
print(child)
print(countf)
cfile(path)
print(totalcount)
[code]
import os
path="/Users/rony/workspace/ecommerce/ecommerce/hot-deploy/"
global totalcount
totalcount =0
def cfile (path):
allfiles = (path)
for file in allfiles:
child = (path,file)
if (child):
cfile(child)
else:
filename,fileext= (child)
print(fileext)
#file type need to calculate
if fileext in ['.java', '.jsp', '.html', '.htm', '.xml', '.sql', '.js', '.ftl', '.css','.groovy'] :
countf = len(open(child,'rU').readlines())
global totalcount
totalcount=totalcount+countf;
print(child)
print(countf)
cfile(path)
print(totalcount)