CFLib.org – Common Function Library Project

FileLastModified(filename)

Last updated June 11, 2009

Version: 1 | Requires: ColdFusion MX | Library: FileSysLib

 
Rated 0 time(s). Average Rating: 0

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:

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

Parameters:

Name Description Required
filename Name of the file. Yes

Full UDF Source:

view plain print about
<cfscript>
/**
 * 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 (mwoods@online.iej.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());
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
11 day(s) ago

Will Belden Will Belden added
longTime
17 day(s) ago

James Sleeman James Sleeman added
quickSort
27 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
30 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 13 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson