订阅本栏目 RSS您所在的位置: 深山工作室 > ASP > 正文

asp利用FSO检测服务器空间文件夹大小

深山行者个人网站 2009/8/17 9:00:37 深山行者 字体: 浏览 8633

asp利用FSO检测服务器空间文件夹大小

<style type="text/css">
* {margin:0;padding:0;font-size:12px;}
body {padding:15px;}
.size1 {font-weight:bold;color:#f00;}
.size2 {font-weight:bold;color:#00f;}
</style>

<%
Sub ShowSpaceInfo(drvpath)
 dim fso,d,size,showsize
 set fso=server.createobject("scripting.filesystemobject")
 drvpath=server.mappath(drvpath)
 set d=fso.getfolder(drvpath)
 size=d.size
 showsize=size & " Byte"
 if size>1024 then
    size=(size\1024)
    showsize=size & " KB"
 end if
 if size>1024 then
    size=(size/1024)
    showsize=formatnumber(size,2) & " MB"
 end if
 if size>1024 then
    size=(size/1024)
    showsize=formatnumber(size,2) & " GB"
 end if
 response.write "<span class='size1'>" & showsize & "</span>"
End Sub
 
Sub Showspecialspaceinfo(method)
 dim fso,d,fc,f1,size,showsize,drvpath
 set fso=server.createobject("scripting.filesystemobject")
 drvpath=server.mappath("pic")
 drvpath=left(drvpath,(instrrev(drvpath,"\")-1))
 set d=fso.getfolder(drvpath)
 if method="All" then
  size=d.size
 elseif method="Program" then
  set fc=d.Files
  for each f1 in fc
   size=size+f1.size
  next
 end if
 showsize=size & "&nbsp;Byte"
 if size>1024 then
    size=(size\1024)
    showsize=size & "&nbsp;KB"
 end if
 if size>1024 then
    size=(size/1024)
    showsize=formatnumber(size,2) & "&nbsp;MB"
 end if
 if size>1024 then
    size=(size/1024)
    showsize=formatnumber(size,2) & "&nbsp;GB"
 end if  
 response.write "<span class='size2'>" & showsize & "</span>"
end sub
  
Function Drawbar(drvpath)
 dim fso,drvpathroot,d,size,totalsize,barsize
 set fso=server.createobject("scripting.filesystemobject")
 drvpathroot=server.mappath("pic")
 drvpathroot=left(drvpathroot,(instrrev(drvpathroot,"\")-1))
 set d=fso.getfolder(drvpathroot)
 totalsize=d.size
 
 drvpath=server.mappath(drvpath)
 set d=fso.getfolder(drvpath)
 size=d.size
 
 barsize=cint((size/totalsize)*400)
 Drawbar=barsize
End Function
  
Function Drawspecialbar()
 dim fso,drvpathroot,d,fc,f1,size,totalsize,barsize
 set fso=server.createobject("scripting.filesystemobject")
 drvpathroot=server.mappath("pic")
 drvpathroot=left(drvpathroot,(instrrev(drvpathroot,"\")-1))
 set d=fso.getfolder(drvpathroot)
 totalsize=d.size
 set fc=d.files
 for each f1 in fc
  size=size+f1.size
 next
 barsize=cint((size/totalsize)*400)
 Drawspecialbar=barsize
End Function
%>

系统空间的使用情况<br>

<%
fsoflag=1
if fsoflag=1 then

    Function GetPP
    dim s
    s=Request.ServerVariables("path_translated")
    GetPP=left(s,instrrev(s,"\",len(s)))
    End function
    if sPP="" then sPP=GetPP
    if right(sPP,1)<>"\" then sPP=sPP&"\"
    set fso=server.createobject("scripting.filesystemobject")
    Set f = fso.GetFolder(sPP)
    Set fc = f.SubFolders
    i=1
                        i2=1
    For Each f in fc
%>

目录<b><%=f.name%></b>占用空间:

<div class="sizediv" style="width:<%=drawbar(""&f.name&"")%>px;"></div><%showSpaceinfo(""&f.name&"")%><br>

<%
    i=i+1
    if i2<10 then
    i2=i2+1
    else
    i2=1
    end if
    Next
%>
程序文件占用空间:
<div class="sizediv" style="width:<%=drawspecialbar%>px;"></div><%showSpecialSpaceinfo("Program")%><br>

系统占用空间总计:
<div class="sizediv" style="width:400px;"></div><%showspecialspaceinfo("All")%>

<%
    else
    response.write "本功能已经被关闭"
    end if
%>

<style>
.sizediv {height:10px;background:#91d65c;border-left:solid 2px #91d65c;}
</style>

相关阅读
asp利用hasOwnProperty验证某个json中的某个标签是否存在
IE中奇怪的左右border断线现象
对MD5加密方式使用者的建议
innerHTML动态改变ID的CSS样式表
深山行者V1.2旅行社网站管理系统
uni-app:使用uni.downloadFile下载word或pdf文件并保存到手机
汽液两相流
放心会计
共有0条关于《asp利用FSO检测服务器空间文件夹大小》的评论
发表评论
正在加载评论......
返回顶部发表评论
呢 称:
表 情:
内 容:
评论内容:不能超过 1000 字,需审核,请自觉遵守互联网相关政策法规。
验证码: 验证码 
网友评论声明,请自觉遵守互联网相关政策法规。

您发布的评论即表示同意遵守以下条款:
一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家、社会、集体和公民的合法权益;
二、不得发布国家法律、法规明令禁止的内容;互相尊重,对自己在本站的言论和行为负责;
三、本站对您所发布内容拥有处置权。

更多信息>>栏目类别选择
百度小程序开发
微信小程序开发
微信公众号开发
uni-app
asp函数库
ASP
DIV+CSS
HTML
python
更多>>同类信息
ASP中Utf-8与Gb2312编码转换乱码问题的解决方法页面编码声明
asp显示随机密码
通过阿里云服务接口获得ip地址详细信息
iis点开后任务栏上有显示,但是窗口看不到的解决办法
RSA加密解密插件
微软Encoder加密解密函数
更多>>最新添加文章
在Android、iOS、Windows、MacOS中微信小程序的文件存放路径
python通过代码修改pip下载源让下载库飞起
python里面requests.post返回的res.text还有其它的吗
aliyun阿里云续费域名优惠口令(注册、续费都可以使用)
windows7环境下安装配置jdk
python对微信操作要用到这两个库wxpy与itchat
ASP中Utf-8与Gb2312编码转换乱码问题的解决方法页面编码声明
DW设置之后更好用 DreamweaverCS编辑GB2312与UTF-8文件在代码视图中点击鼠标错位问题的解决办法
更多>>随机抽取信息
比较实用的利用javascript按比例相应缩放图片大小
纯div+css制作的弹出菜单-02
深山行者v1.0 PSD 源文件下载
深山行者留言系统V3.3发布
网站首页head区代码规范
非常不错的页面搜索器,还可以移动