- <%@ 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>
使用FSO按文件大小浏览文件目录并进行删除操作
2019-11-01 12:46asp教程网 ASP教程
使用FSO按文件大小浏览文件目录并进行删除操作
延伸 · 阅读
- 2022-02-25浅谈Linux文件目录介绍及文件颜色区别
- 2021-12-10关于Python OS模块常用文件/目录函数详解
- 2021-11-10Python关于OS文件目录处理的实例分享
- 2021-07-19python对文件目录的操作方法实例总结
- 2021-06-23Python实现的栈、队列、文件目录遍历操作示例
- 2021-02-18VC文件目录常见操作实例汇总
精彩推荐
- ASP教程
ASP.NET 数据源
数据源 一个 data sourse 控件与数据绑定的控件相互作用,并隐藏了复杂的数据的联编过程。这些是提供数据给 data bound 控件的工具,并且支持如插入,删除...
- ASP教程
asp Access数据备份,还原,压缩类代码
asp Access数据备份,还原,压缩类实现代码,大家可以参考下。...
- ASP教程
asp之基于adodb.stream的文件操作类
asp之基于adodb.stream的文件操作类...
- ASP教程
asp 采集实战代码
最近实在是太流行采集了,本人是不喜欢采集的,但对采集的原理我却很有兴趣进行研究,拿到了网上采集常用函数,对其进行了一番研究,并实战,结果...
- ASP教程
asp 标记字符串中指定字符变色不区分大小写
今天遇到这种问题,单纯的使用replace函数不行,他会改变原有的字符串的大小写,在网上找到相关的代码,自己备份下...
- ASP教程
JScript中遍历Request表单参数集合的方法
这篇文章主要介绍了JScript中遍历Request表单参数集合的方法,本文以遍历Request.QueryString集合为例给出了实现代码,需要的朋友可以参考下...
- ASP教程
ASP常用函数:getpy()
ASP常用函数:getpy()...
- ASP教程
asp+javascript实现404页的处理转换
asp+javascript实现404页的处理转换...