Using the code to delete directories and files in bulk with ASP-application techniques

Source: Internet
Author: User
Function procedure:
Copy Code code as follows:

<%
' Del.asp
Dim fso,tmpfolder,tmpsubfolder,tmpfile,tmpfiles
Set Fso=server. CreateObject ("Scripting.FileSystemObject")
Sub Delfolder (spath)
If (FSO). FolderExists (server. MapPath (spath)) Then
Set TMPFOLDER=FSO. GetFolder (server. MapPath (spath))
Set Tmpfiles=tmpfolder.files
For each tmpfile in Tmpfiles
Fso. DeleteFile (Tmpfile)
Next
Set Tmpsubfolder=tmpfolder. Subfolders
For each tmpfolder in Tmpsubfolder
Response. Write spath& "/" &tmpfolder.name& "<br>"
Delfolder (spath& "/" &tmpfolder.name)
Next
Fso. DeleteFolder (server. MapPath (spath))
End If
End Sub
%>

Call Method:
Copy Code code as follows:

<%
' Call example
' del.asp to the same level as the directory you want to delete, the directory you want to delete exists and has several subdirectories and files under it, to which you have permission to modify.
Delfolder ("Directory Name")
%>

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.