Asp deletes image Codes not recorded in the mssql database

Source: Internet
Author: User

Dual Loop is used. Split the image into "." and ask the previous part of the name. Then compare the image path records in other databases.
If the InStr function of vb exists, the returned value is greater than 0, so we can draw a conclusion.
The Code is as follows: deal. asp Copy codeThe Code is as follows: <% @ language = "vbscript" %>
<% Response. Expires = 0%>
<! -- # Include file = "conn. asp" -->
<%
Dim objFSO, objFolder, objFile, FF 'declare the objFSO variable to store the object instance
FF = Server. MapPath ("pro_s /")
Set objFSO = Server. CreateObject ("Scripting. FileSystemObject ")
If objFSO. FolderExists (ff) Then
All files in Response. write "folder" & 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.exe cute ("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 "folder" & ff & "does not exist. Related information cannot be read! "
End If
Set objFolder = Nothing
Set objFSO = Nothing 'to release the memory space of the FileSystemObject object instance
%>

From: http://blog.csdn.net/lingfeng179/archive/2009/08/19/4463679.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.