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

ASP
asp调用存储过程
利用批处理文件和 vbs 脚本实现网站视频自动录制
ASP、vbscript编码模板
FileSystem对象常用的文件操作函数有哪些?
asp显示日历效果
sql语句的一些集合
ASP语法注释
函数名称 函数功能
万能数据库连接程序
记录集内随机取记录的代码
分页代码
如何在数据库中用好Transaction?
用Command对象和RecordSet对象向数据库增加记录哪一个更好
为什么在存储过程中用OLEDB方式不能返回记录集
如何查询日期类型的数据?
ASP如何获取真实IP地址
两种小偷程序的比较
使用xmlHttp结合ASP实现网页的异步调用
用ASP开"多线程"
整理了一个editplus的剪辑文件(ASP方面的内容)

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


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