可能删不干净版:

<%
'On Error Resume Next
ClearFile Server.MapPath("") '清空当前目录除自身外所有文件

Function ClearFile(Path) '清空目录所有文件
Dim Fso,ObjFolder,ObjFile 'Fso对象,子目录对象,文件对象
Set Fso=Server.CreateObject("scripting.filesystemObject") '创建FSO读写对象
For Each ObjFile in Fso.GetFolder(Path).Files '读取当前目录下的文件
    Response.Write "<font color=#0000FF>文件:</font>" & Path & "\" & ObjFile.Name & " --> 删除成功! <br>"
    'If Replace (Lcase(Path & "\" & ObjFile.Name),"\\","\") <> Lcase(Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))) Then
    Fso.DeleteFile Path & "\" & ObjFile.Name
Next
For Each ObjFolder In Fso.GetFolder(Path).SubFolders '读取子目录
    Response.Write "<font color=#00FF00>目录:</font>" & Path & "\" & ObjFolder.Name & " --> 删除成功! <br>"
    Fso.DeleteFolder Path & "\" & ObjFolder.Name,true
Next
Response.Write "<br><font color=#FF0000>目录:" & Path & " 清空完毕。完成时间:" & Now() & "</font>"
End Function
%>

可以完全清理版:

<%
'On Error Resume Next
ClearFile Server.MapPath("./") '清空当前目录除自身外所有文件

Function ClearFile(Path) '清空目录所有文件
Dim Fso, ObjFolder, ObjFile 'Fso对象,子目录对象,文件对象
Set Fso = Server.CreateObject("scripting.filesystemObject") '创建FSO读写对象
For Each ObjFile in Fso.GetFolder(Path).Files '读取当前目录下的文件
    If Replace (Lcase(Path & "\" & ObjFile.Name),"\\","\") <> Lcase(Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))) Then
        Response.Write "<font color=#000000>文件:" & Path & "\" & ObjFile.Name & " --> 删除成功! </font><br>"
        Fso.DeleteFile Path & "\" & ObjFile.Name
    End IF
Next
For Each ObjFolder In Fso.GetFolder(Path).SubFolders '读取子目录
    ClearFile Path & "\" & ObjFolder.Name
    Response.Write "<font color=#FF0000>目录:" & Path & "\" & ObjFolder.Name & " --> 删除成功! </font><br>"
    Fso.DeleteFolder Path & "\" & ObjFolder.Name,true
Next
Response.Write "<font color=#0000FF>目录:" & Path & " ---> 清空完毕。完成时间:" & Now() & "</font><br>"
End Function
%>