这是个删除非空目录的例子
test.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
delfolder(spath&"/"&tmpfolder.name )
next
fso.deletefolder (server.mappath (spath))
end if
end sub
%>
<%
调用例子
test.asp放到wwwroot\下
wwwroot\1\存在,且其他下有若干子目录和文件
delfolder("1")
%>