当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP得到文件的大小类型最后修改时间

ASP
asp中常用的文件处理函数
正确处理ASP动态网页中的容错机制
asp自动生成javascript检验函数
如何避免asp的SQL的执行效率低
编译asp应用程序成为exe文件
ASP完成小偷程序机制和简略示例
ASP技巧:rs.getrows方法
ASP简单实现数字字符混合验证码
ASP技巧 挂QQ的网页源代码ASP/PHP
ASP实例:用ASP判断文件地址是否有效
ASP实例:使用ASP生成图片彩色校验码
ASP如何跳出本次进入下一次循环
ASP读取数据库中数据到数组的类
为你的ASP程序作一个负载测试
如何用ASP来获取客户端真实IP的地址
asp脚本运行超时的解决办法
ASP缓存类 【先锋缓存类】Ver2004
ASP动态包含文件的改进方法
ASP中利用application实现缓存
ASP Application 对象用户手册

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 41 ::
收藏到网摘: n/a

要得到生成的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",改成你需要的文件,即可判断,都有注释,自己修改吧.