用法: python test.py /home/lx/c/test
#test how much lines in a directory.
import os,sys
def cout( current_doc ):
os.chdir( current_doc )
doc_list = os.listdir( current_doc )
for i in doc_list:
if os.path.isfile( i ):
os.system( 'wc -l ' + i + ' >> l')
os.system( "awk '{total += $1; print total }' l ")
os.system( "rm l" )
if __name__ == "__main__":
cout( sys.argv[1] )