欢迎光临
我们一直在努力

把这个组成文件就行了!,建议斑竹加精华!关键字:使用FSO按文件大小浏览文件目录并进行删除操作

建站超值云服务器,限时71元/月

<%@ language=vbscript %>
<%server.scripttimeout=50000%>
<html>
<head>
<meta name="generator" content="microsoft visual studio 6.0">
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<body>
<%
  function judgepararegular(intid)
    if intid<>"" and isnumeric(intid) then
      judgepararegular=intid
    else
      response.write "输入错误!"  
      response.end
    end if
  end function
  intfilesize=judgepararegular(request.querystring("intfilesize"))
  strpath=request.querystring("strpath")
  if instr(strpath,":")=0 then strpath=server.mappath(strpath)
%>
<%
function deletefiles(path)
    on error resume next
    set fs=server.createobject("scripting.filesystemobject")
    if fs.fileexists(path) then
      fs.deletefile path,true
      response.write "成功删除"&path
    else
      response.write "文件不存在!"
    end if
    set fs=nothing
    if err.number<>0 then response.write err.number
end function
strfile=request("strfile")
if request("strfile")<>"" then
  deletefiles strfile
end if  

%>

<%
function listfolderfiles(strpath,intfilesize,intflag)
  stroriginpath= request.servervariables("script_name")& "?strpath=" &request.querystring("strpath") & "&intfilesize="&request.querystring("intfilesize")
  if strpath<>"" then
    if intflag=0 then
      intflag=intflag+1
    end if  
    set objfs=server.createobject("scripting.filesystemobject")
    set objfdir=objfs.getfolder(strpath)
    strparentpath= objfs.getparentfoldername(strpath)
    for each strsubfiles in objfdir.files
      if strsubfiles.size /(1024^2)>=intfilesize then
      response.write "<tr>" & vbcrlf
      response.write "<td>" & replace(strnulltran(strsubfiles),strnulltran(strsubfiles.name),"<b>"&strnulltran(strsubfiles.name)&"</b>")  & "</td>" & vbcrlf
      response.write "<td>"& strnulltran(formatnumber(strsubfiles.size /(1024^2),2)) &" mb</td>" & vbcrlf
      response.write "<td>" & strnulltran(strsubfiles.type)  & "</td>" & vbcrlf
      response.write "<td>" & strnulltran(strsubfiles.datelastmodified)  & "</td>" & vbcrlf
      response.write "<td><a href="&  stroriginpath &   "&strfile="&strnulltran(strsubfiles)&"><img align=absmiddle border=0 src=images/delete.gif></a></td>" & vbcrlf
      response.write "</tr>" & vbcrlf
      intflag=intflag+strsubfiles.size
      end if
    next
    for each strsubfolders in objfdir.subfolders
      if intflag=0 then intflag=1
      listfolderfiles strsubfolders,intfilesize,intflag
    next
  else
    response.write "<tr><td colspan=5>输入错误!</td></tr>"
  end if
  listfolderfiles=intflag
end function
function strnulltran(str)
  if isnull(str) or str="" then
    strnulltran=" "
  else
    strnulltran=str
  end if
end function  
response.write "<table width=100% border=1 cellspacing=1 cellpadding=1>" & vbcrlf
response.write "<tr>" & vbcrlf
response.write "<td>文件名及路径</td>" & vbcrlf
response.write "<td align=center>大小</td>" & vbcrlf
response.write "<td  align=center>类别</td>" & vbcrlf
response.write "<td align=center>修改时间</td>" & vbcrlf
response.write "<td align=center>删除</td>" & vbcrlf
response.write "</tr>" & vbcrlf
intflag=listfolderfiles(strpath,cdbl(intfilesize),0)
response.write  "<tr><td align=right>总计:</td><td colspan=4>"&formatnumber((intflag-1)/(1024^2),2) &" mb</td></tr>" & vbcrlf
response.write "</table>" & vbcrlf
%>
</body>
</html>

————-文件名test.asp————————
———————使用方法———————
test.asp?strpath=./&intfilesize=0
具体的用途你自己看着办,绝对实用!

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 把这个组成文件就行了!,建议斑竹加精华!关键字:使用FSO按文件大小浏览文件目录并进行删除操作
分享到: 更多 (0)

相关推荐

  • 暂无文章