当前位置: 移动技术网 > IT编程>开发语言>Asp > ASP得到文件的大小类型最后修改时间

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

2017年12月12日  | 移动技术网IT编程  | 我要评论
要得到生成的html文件的最后修改时间,写了一个函数,有简单的判断.

实例:

2005-11-10 19:33:44 asp 文件 6.83 kb

把下面文件另存为mofei.asp文件,运行即可,要fso支持.

<%
function fsofiledatemofei(sfile)
'通过fso得到文件的时间,类型,大小;sfile是文件名
'制作:默飞
'qq:33224360
'home:
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",改成你需要的文件,即可判断,都有注释,自己修改吧.

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网