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

READING FILE DATES !!!

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 VBScript 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.
Any ideas ??

Mac
 
Try to use the whole path to the file...

<HTML>
<script language=&quot;vbscript&quot;>
set fso=CreateObject(&quot;Scripting.FileSystemObject&quot;)
'let's say
pathtofile=&quot;c:\c.csv&quot;
set File=fso.GetFile(pathtofile)
filedate=File.DateLastModified
msgbox filedate
</script>
</HTML>

Hope this hepls ________

George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top