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:

 <%Set objFileSystem = CreateObject("Scripting.FileSystemObject")dir = Server.MapPath(".")'Get the files collectionSet colFiles = objFileSystem.GetFolder(dir).Files	defaultDate = #3/1/1825#latestDate = defaultDateFor Each file in colFiles	filedate = file.DateLastModified	if DateDiff("s", defaultDate, filedate) > 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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may

man on floor with data

DevX Quick Guide to Data Ingestion

One of the biggest trends of the 21st century is the massive surge in internet usage. With major innovations such as smart technology, social media, and online shopping sites, the internet has become an essential part of everyday life for a large portion of the population. Due to this internet

payment via phone

7 Ways Technology Has Changed Traditional Payments

In today’s digital world, technology has changed how we make payments. From contactless cards to mobile wallets, it’s now easier to pay for goods and services without carrying cash or using a checkbook. This article will look at seven of the most significant ways technology has transformed traditional payment methods.