ASP obtains the last modification time of the file size type.

Source: Internet
Author: User
Tags servervariables

To get the last modification time of the generated HTML file, write a function with simple judgment.

Instance:

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

Save the following file as a mofei. asp file and run it. You need FSO support.

<%
Function fsofiledatemofei (sfile)
'Get the file time, type, size through FSO; sfile is the file name
'Production: mofei
'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/) & "kb" 'size
Set FSO = nothing
Fsofiledatemofei = sfilere
End Function

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

Obviously, modify "index. asp" and change it to the file you need. You can check that there are comments. Modify them by yourself.

Related Article

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.