現在のフォルダーにあるJSコードとASPコードの行の数を計算し、コードの数を数えることもできます
サンプルコードがあります
コードコピーは次のとおりです。
<%
'////////////////////////////////////////////////
'//
'// codeproject.comから
'// JSとASPコードを計算します
'// bluedestinyを変更します
'//mail:bluedestinyat126.com
'//
'////////////////////////////////////////////////
optionexplicit
Response.buffer = false
classcount_code
privatefso、spath
privateasplines、jslines、aspbytes、jsbytes、aspords
privatesubclass_initialize
setFSO = createObject( "Scripting.filesystemObject")
Endingub
privatesubclass_terminate
setfso =何もない
Endingub
privateFunctionterate(パス)
dimfolder、フォルダー、ファイル、ファイル、ts、txt、arr、f
setFolder = fso.getFolder(PATH)
setfiles = folder.files
Dimrx、c
setrx = newRegexp
rx.ignorecase = true
rx.global = true
rx.pattern = "+"
foreachfileinfiles
ifright(file.name、4)= "。asp" orright(file.name、3)= "。js" then
setts = file.openastextStream
ifts.AtendofStreamThentxt = "" elsetxt = ts.readall
ts.close
txt = rx.replace(txt、 "")
txt =置換(txt、vbcrlf&vbcrlf、vbcrlf)
arr = split(cheplage(txt、vbcrlf、 "")、 "")
aspwords = aspwords+ubund(arr)
arr = split(txt、vbcrlf)
ifright(file.name、4)= "。asp" then
asplines = asphines+ubund(arr)
aspbytes = aspbytes+len(txt)
それ以外
jslines = jslines+ubund(arr)
jsbytes = jsbytes+len(txt)
endif
endif
次
setFolders = folder.subfolders
foreachfinfolders
iteratef.path
次
エンド機能
publicPropertyletpath(s)