ASP如何得到文件的大小类型最后修改时间

要得到生成的HTML文件的最后修改时间,写了一个函数,有简单的判断.

实例:

2005-11-10 19:33:44 ASP 文件 6.83 KB
把下面文件另存为mofei.asp文件,运行即可,要FSO支持.

<%
Function fsofiledatemofei(sfile)
'通过FSO得到文件的时间,类型,大小;sfile是文件名
'制作:默飞
'QQ:33224360
'HOME: http://www.8vb.cn
sfilere=""
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if sfile="" or isnull(sfile) then sfile=Request.ServerVariables("SCRIPT_NAME")
if not fso.FileExists(server.Mappath(sfile)) then sfile=Request.ServerVariables("SCRIPT_NAME")
sfile=server.Mappath(sfile)
Set fsofile=fso.getfile(sfile)
sfilere=sfilere&fsofile.DateLastModified '文件时间
sfilere=sfilere&chr(9)&"<font color=green>"&fsofile.type&"</font>" '类型
sfilere=sfilere&chr(9)&round(fsofile.size*1000/1024/1000,2)&" KB" '大小
set fso=nothing
fsofiledatemofei=sfilere
End Function
response.write fsofiledatemofei("index.asp")
%>
很明显,修改"index.asp",改成你需要的文件,即可判断,都有注释,自己修改吧.  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值