devxlogo

Determine Last Modified Date With the FileSystemObject

Determine Last Modified Date With the FileSystemObject

I often go to a site, scroll to the bottom, and see when it was last modified. If it says “March 1, 1825” then I am usually not so confident that the content is timely. Unfortunately, sometimes it is just the poor overworked Webmaster who has not had time to update the date on the page. Why do it manually when Microsoft provides the FileSystemObject, which can retrieve all kinds of information about files, including when it was last modified? Place this script at the bottom of your page and you’ll see what I am talking about:

  0 Then		latestDate = fileDate	End IfNextResponse.Write(latestDate)%>

Basically, you can retrieve the collection of files in the same directory with the FileSystemObject. Once you have that, you can determine the latest modified date by comparing the DateLastModified property versus an arbitrary date (defaultDate) for each one. Output it to the browser and you are all set.

devx-admin

Share the Post: