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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HI I need to read the date last mod

Status
Not open for further replies.

mac4511

Technical User
Apr 26, 2001
14
GB
HI I need to read the date last modified of a file.
The file is NOT the web page with the Script in it , but an external .csv file used with Databinding at the same level as the web page reading its data.
I know the following VBSCRIPT is supposed to do that for me but i cannot get it to work. My file name is c.csv.

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile("YourFilename")
ModDate = f.DateLastModified

I have tried "c.csv", "\c.csv" and "\\c.csv" where it shows "YourFilename" but I cannot figure out how to get the value ModDate to display on the web page. Should I enclose it in a function ? If so how do I call that from HTML ?

Excuse the ignorance, but I have tried all over microsfts site but you never get a full working example.

I can get the following Javascript to give me the date of the web page in which it exists, but I want the same details of c.csv !!

<script language=&quot;Javascript&quot;>
var dateModified = document.lastModified;
mydate = dateModified.slice(0,9);
document.write(&quot;<b>Last updated: &quot; + mydate + &quot;</b>&quot;);
</script>

even a Javascript variant of this would be great.
I think I'm missing something obvious

Any ideas ??

Mac
 
Hello,
Do you have ASP?
If yes, then the code in some.asp file is:
<%
Set fso = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set f = fso.GetFile(&quot;c:\Inetpub\ModDate = f.DateLastModified
Response.Write ModDate
%>
If no, I also will be glad to learn how.
D.
 
mac4511,

The code I gave you is for a local file using VBscript. If you are incorporating that into an ASP page, then you have to decide if the file is on the client or on the web server.

If it's on the web server, the code should run as is. If it's on the client, first you need to know if the client's browser is an IE that can run VBscript and that the location of the file is correct. It basically all comes down to the question - &quot;Where is the code executing? web seerver or client?

Cheers,
Fengshui1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top