Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FilesystemObject and the current file name

Status
Not open for further replies.

PetertheImp

Technical User
Aug 20, 2002
4
0
0
GB
FileSystmeObject current file name.

I want to dynamically put a last modified date on the bottom of every page of my website, Using the FileSystmeObject I can put the last modified date on the page But I have to specify in the MapPath the page for which the date is taken from, I have a lot of pages and don't want to have to open every single one, Is there a way of specifiy the current file name i.e. default.asp so that I can do a global find and replace and put this on every page.

This is what I am using already

<%
Set fs = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set rs = fs.GetFile(Server.MapPath(&quot;default.asp&quot;))
modified = rs.DateLastModified
%>

Any idea's anything,

Thanks in Advance
 
The Server variable SCRIPT_NAME will return the current file name, so you could substitute that into your Server.MapPath statement like so:
<%
Dim fso
Set fso = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Response.Write fso.GetFile(Server.MapPath(Request.ServerVariables(&quot;SCRIPT_NAME&quot;))).DateLastModified
%>


I am psychic, I can read your mind and your future, I see, I see,
I see large amounts of copy + paste in your future :)

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top