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

ASP
如何在 Access 2003 和 Access 2002 中创建 DSN 的连接到 SQLServer 对链接表
值得收藏的一些HTML、JavaScript、ASP代码
Asp遍历服务器对象的代码
保证asp叶面一定不会出现乱码 UTF8
ASP 非法字符过滤函数
ASP FSO文件处理函数大全
asp 常用函数用法
文章内页类
Asp类 的数据库领域
ASP ACCESS 日期操作语句小结 By Stabx
经典的分页完整程序+注释
vbcrlf的意思
js+asp总结
解决rs.absolutepage=-1的问题
ASP实现URL编码
FileSystemObject 对象
写入文本文件的过程函数(ASP)
FSO的强大功能
FSO 读出TXT文件
不用模板,只用ASP+FSO生成静态HTML页的一个方法

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 61 ::
收藏到网摘: 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",改成你需要的文件,即可判断,都有注释,自己修改吧.