删除FrontPage自动生成的垃圾文件

来源:互联网 发布:笔记本强制散热软件 编辑:程序博客网 时间:2024/06/06 04:19

<%
'**************************************************************
'*     作者:Rock                                                *
'*     E_Mail:mh_rock@163.com                                   *
'*     本人喜欢用FrontPage但是一建网站的或以网站的方式打开就会 *
'* 出现一些垃圾文件,特别烦人.                                  *
'**************************************************************
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除FrontPage自动生成的垃圾文件</title>
</head>
<%
act=request.querystring("act")
folder=""
msg=""
if act="del" then
folder=request.form("folder")
call delFolder(folder)
msg="程序执行完毕......"
end if
sub delFolder(path)
if right(path,1)<>"/" then path=path&"/"
set fso=server.CreateObject("scripting.filesystemobject")
if fso.folderexists(path) then
   if fso.folderexists(path&"_derived") then fso.DeleteFolder(path&"_derived")
   if fso.folderexists(path&"_private") then fso.DeleteFolder(path&"_private")
   if fso.folderexists(path&"_vti_cnf") then fso.DeleteFolder(path&"_vti_cnf")
   if fso.folderexists(path&"_vti_pvt") then fso.DeleteFolder(path&"_vti_pvt")
   if fso.FileExists(path&"desktop.ini") then fso.DeleteFile(path&"desktop.ini")
   set objFolder=fso.GetFolder(path)
   set objSubFolders=objFolder.Subfolders
   for each objFile in objSubFolders
    call delfolder(objFile) '递归删除子文件夹
   next
end if
end sub
%>
<body>
<script language="javascript">
function check()
{
if(f.folder.value=="")
{
   alert("请出入一个绝对地址的路径!!!如:D://新建文件夹");
   return false;
}
return confirm("您确定要删除<<"+f.folder.value+">>目录下的垃圾文件吗?");
}
</script>
<div align="center">

<table border="1" width="400">
<form name="f" action="?act=del" method="post" onsubmit="return check()">
<tr bgcolor="#f4f4f4">
   <td colspan="2" height="30" align="center">删除FrontPage自动生成的垃圾文件</td>
</tr>
<tr>
   <td width="332"><input type="text" name="folder" size="49" value="<%=folder%>"></td>
   <td><input type="submit" value="提 交" name="B1"></td>
</tr>
<tr>
   <td height="52" colspan="2"><%=msg%></td>
</tr>
</form>
</table>
</div>

</body>

</html>

 
原创粉丝点击