Find the last modified date of a file.
One technique is to perform a directory listing filtered to just the file you are interested in, then extract the last modified information. Another technique is to use underlying Java File object which also provides a last modified value.
There are a couple of techniques for finding the last modified date of a file within ColdFusion.
The first technique performs a directory listing filtered to just the file you are interested in:
<cfset fileDir = "/full/path/to/dir/containing/file/")> <cfset fileName = "yourfile.txt"> <cfdirectory action="list" directory="#fileDir#" filter="#fileName#" name="fileInfo"> <cfset fileDate = parseDateTime(fileInfo.dateLastModified)>
The second technique makes use of ColdFusion's underlying Java:
<cfset filePath = "/full/path/to/yourfile.txt">
<cfset fileObj =
createObject("java","java.io.File").init(filePath)>
<cfset fileDate =
createObject("java","java.util.Date").init(fileObj.lastModified())>
+