Use double loops. Take the picture "." After the split name asked the previous section, that the rest of the database in the picture path record to compare
Using the InStr function of VB, if there is a return value of >0, can come to a conclusion
The code is as follows deal.asp
Copy Code code as follows:
<%@ language= "VBScript"%>
<%response. Expires = 0%>
<!--#include file= "conn.asp"-->
<%
Dim objfso,objfolder,objfile,ff ' declares objFSO variable holds object instance
FF = Server.MapPath ("pro_s/")
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
If objfso.folderexists (FF) Then
Response.Write "Folder" &ff& "All the Files:<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 as 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 "Folder" &ff& does not exist and cannot read the relevant information! "
End If
Set objfolder = Nothing
Set objFSO = Nothing ' Frees FileSystemObject object instance memory space
%>
From: http://blog.csdn.net/lingfeng179/archive/2009/08/19/4463679.aspx