CFLib.org – Common Function Library Project

FileLastModified(filename)

Last updated June 11, 2009

author

Jesse Houwing

Version: 1 | Requires: CF6 | Library: FileSysLib

Description:
Returns the date the file was last modified. The date is adjusted according to timezone. It returns a valid coldfusion date object. It uses the standard Java File object, which makes it very fast under Coldfusion MX

Return Values:
Returns a date.

Example:

<cfset filename="c:\autoexec.bat">
<cfoutput>
	Length: #FileLastModified(filename)#<br>
</cfoutput>

Parameters:

Name Description Required
filename Name of the file. Yes

Full UDF Source:

/**
 * Returns the date the file was last modified.
 * v2 fixes for DTS by Mark Woods (mwoods@online.ie)
 * 
 * @param filename 	 Name of the file. (Required)
 * @return Returns a date. 
 * @author Jesse Houwing (j.houwing@student.utwente.nl) 
 * @version 1, June 11, 2009 
 */
function FileLastModified(filename){
	var oFile = createObject("java","java.io.File");
	var oDate = createObject("java","java.util.Date");
	oFile.init(fileName);
	return oDate.init(oFile.lastModified());
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson