If you are using ASP then this script will display all the
files in the folder you put it in. If you us a form and substitute
a file name for the proper variable it will display a file, it also
shows the date last modified, you might be able to modify it to do
exactly what you want. notice this line <%=
objFileItem.DateLastModified %> it gives the date last modified,
you could use this also check into the FileSystemObject
'CODE:
<%
Dim strPathInfo, strPhysicalPath
strPathInfo = Request.ServerVariables("PATH_INFO") 'get
virtual path of file
strPhysicalPath = Server.MapPath(strPathInfo) 'get physical
path of file
Dim objFSO, objFile, objFileItem, objFolder,
objFolderContents
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
%>
<TABLE border="1" cellpadding=10 bordercolor="#3366CC">
<TR Align=center>
<TH align=left>File Name</TH>
<TH>File Type</TH>
<TH>File Size</TH>
<TH>Last Modified</TH>
<TH>View Source</TH>
</TR>
<%
For Each objFileItem In objFolderContents
%>
<TR>
<TD Align=left>
<A HREF="<%= objFileItem.name %>">
<Font Face="Verdana" size="3">
<%= objFileItem.Name %></Font>
</A>
</TD>
<TD align=right>
<FONT FACE="Tahoma" Size"2" >
<%= objFileItem.type %></FONT>
</TD>
<TD align=right>
<FONT FACE="Tahoma" Size="2" >
<%= objFileItem.size %></FONT>
</TD>
<TD align=right>
<FONT FACE="Tahoma" Size="2" >
<%= objFileItem.DateLastModified %></FONT>
</TD>
<TD align=right>
<FONT FACE="Tahoma" Size="2">
<A HREF="DisplaySourceINTDIR.asp?FileName=<%=
objFileItem.Name %> ">View Source</A></FONT>
</TD>
</TR>
<%
Next
%>
</TABLE>
' Here is the code for the "DisplaySourceINTDIR.asp" page
that displays the source you can delete the link if you want
<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1,
TristateFalse = 0
Dim strPathInfo, strPhysicalPath
strPathInfo = Request.QueryString("FileName")
strPhysicalPath = Server.MapPath(strPathInfo)
Dim objFSO, objFile
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.GetFile(strPhysicalPath)
%>
<HTML>
<HEAD>
<TITLE><%= objFile.Name %> Source
Code</TITLE>
</HEAD>
<BODY>
Source Code For: <%= objFile.Name %><HR><P>
<font face=FranklinGothicBookman size=4>
<%
Dim objFileTextStream
Set objFileTextStream = objFile.OpenAsTextStream(ForReading,
TristateUseDefault)
Dim strLine
Do While objFileTextStream.AtEndOfStream <> True
strLine = Server.HTMLEncode(objFileTextStream.ReadLine)
strLine = Replace (strLine, Chr(9),
" ")
Response.Write strLine
Response.Write "<BR>" + vbCrLf
Loop
objFileTextStream.Close
%>
</font>
<BR>
<BR>
<HR>
<A HREF="<%= Request.ServerVariables("HTTP_REFERER")
%>">Return to Directory</A>
</Body>
</HTML>