优秀的软件开发团队:深圳升蓝软件 数据库开发 .Net技术  |  ASP技术 PHP技术 JSP技术 应用技术类     
热门推荐
升蓝OA办公自动化系统
基于.Net技术的网络
协同办公环境
 
ASP基础
数据库相关
安全加密
全文检索
ASP应用
打印相关
客户端相关
XML相关
系统相关
正则表达式
ASP技巧
组件开发
脚本编码
FSO专题
邮件相关
远程脚本
性能优化
 
相关链接
深圳升蓝软件:系统集成、办公自动化平台、电子商务、电子政务、Web数据库、企业网站、游戏、手机应用程序、CDMA软件、电子出版物等,为客户提供优秀的解决方案
 
升蓝(www.hi-blue.com)为企业管理、政府办公提供成熟的、易于实施的IT技术服务,我们的解决方案包括OA办公自动化系统CRM客户关系管理系统ERP企业生产管理和订单管理系统电子政务系统、知识管理系统、企业门户、商业智能、工程项目管理等等...
 
电子政务解决方案
塑料/橡胶管理系统
知识管理系统简介
多媒体光盘方案
ERP企业资源管理
订单计划管理系统
PM工程项目管理系统
会员管理系统
相关资料下载
OA办公自动化系统
CRM客户关系管理系统
在线试用版本说明
OA 系统的用户手册
 
 
 
 
升蓝开发团队 > 技术资料 > ASP技术 > FSO专题 : 使用FSO按文件大小浏览文件目录并进行删除操作

使用FSO按文件大小浏览文件目录并进行删除操作


March 25,2004
<%@ 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>
数据库开发 | .Net技术 | ASP技术 | PHP技术 | JSP技术 | 应用技术类 | 升蓝开发小组
Copyright ? 2001-2004 Shenzhen Hi-blue Software Team 升蓝开发小组 All rights reserved