ASP get file size type Last modified time _asp base

Source: Internet
Author: User
To get the last modification time of the generated HTML file, write a function that has a simple judgment.

Instance:

2005-11-10 19:33:44 ASP file 6.83 KB

Save the following file as a mofei.asp file, run it, to support the FSO.

<%
Function Fsofiledatemofei (sfile)
' time, type, size of file obtained via FSO; sfile is file name
' Make: Silent Fly
' 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 ' File Time
SFILERE=SFILERE&CHR (9) & "<font color=green>" &fsofile.type& "</ Font> "' Type
SFILERE=SFILERE&CHR (9) &round (fsofile.size*1000/1024/1000,2) &" KB "' Size
Set fso= Nothing
Fsofiledatemofei=sfilere
End Function

Response.Write Fsofiledatemofei ("index.asp")
%>

Obviously, modify the "index.asp", change to the file you need, you can judge, there are comments, you modify it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.