This is an example of deleting a non-empty directory
' Test.asp
' To perform the deletion you need to have permission to modify the directory
<%
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
Delfolder (spath& "/" &tmpfolder.name)
Next
Fso. DeleteFolder (server. MapPath (spath))
End If
End Sub
%>
<%
' Call example
' Test.asp put it under the wwwroot\.
' Wwwroot\1\ exists, and there are several subdirectories and files under the other
Delfolder ("1")
%>