深圳月租车价格明细表:请教如何统计一大堆asp文件的总行数?

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/03 19:27:37
我自己不会编程,有什么软件能实现这个功能吗?谢谢!
我会追加30分的

读取ASP或JSP文件,并检查行数

<%
option explicit
dim fso
set fso = createobject("scripting.filesystemobject")
dim asplines, jslines, aspbytes, jsbytes, aspwords
iterate(server.mappath("/web_api"))
response.write "ASP:
Total Lines Coded: " & asplines & "
Total Bytes: " & aspbytes & "
Total Individual Elements (words) Typed: " & aspwords
response.write "

JScript:
Total Lines Coded: " & jslines & "
" & "Total Bytes: " & jsbytes

function iterate(path)
dim folder, folders, files, file, ts, txt, arr, f
set folder = fso.getfolder(path)
set files = folder.files
dim rx, c
set rx = new regexp
rx.ignorecase = true
rx.global = true
rx.pattern = " +"
for each file in files
if right(file.name,4)=".asp" or right(file.name,3)=".js" then
set ts = file.openastextstream
if ts.atendofstream then txt = "" else txt = ts.readall
ts.close
txt = rx.replace(txt," ")
txt = replace(txt,vbcrlf&vbcrlf,vbcrlf)
arr = split(replace(txt,vbcrlf," ")," ")
aspwords = aspwords + ubound(arr)
arr = split(txt,vbcrlf)
if right(file.name,4)=".asp" then
asplines = asplines + ubound(arr)
aspbytes = aspbytes + len(txt)
else
jslines = jslines + ubound(arr)
jsbytes = jsbytes + len(txt)
end if
end if
next
set folders = folder.subfolders
for each f in folders
iterate f.path
next
end function
%>

输出效果可以是:
ASP:
Total Lines Coded: 15540
Total Bytes: 628957
Total Individual Elements (words) Typed: 86189

JScript:
Total Lines Coded: 4282
Total Bytes: 155837</PRE>