%@ language="vbscript"%> %response.Expires = 0%> !--#include file="conn.asp"--> % Dim objFSO,objFolder,objFile,FF '聲明 objFSO 變量存放對象實例 FF = Server.MapPath("pro_s/") Set objFSO = Server.CreateObject("Scripting.FileSystemObject") If objFSO.FolderExists(ff) Then Response.write "文件夾 "ff" 里所有的文件:br>" Set objFolder = objFSO.GetFolder(ff)
For Each objFile in objFolder.Files %> % filename=cstr(objFile.name) myname=split(filename,".") ffname=myname(0) a=0 set sclass=conn.execute("select img from wksc_pro ") do while not sclass.eof
result=Instr(sclass("img"),ffname) a=a+result if(a>0) then exit do end if
sclass.movenext loop if(a=0) then response.Write ""objFile"" response.Write"br>" objFile.delete
end if %> % Next Else Response.Write "文件夾"ff"不存在,無法讀取相關信息!" End If Set objFolder = Nothing Set objFSO = Nothing '釋放 FileSystemObject 對象實例內存空間 %>