CFLib.org – Common Function Library Project

FileLastModified(filename)

Last updated June 11, 2009
Download UDF

author

Jesse Houwing Jesse Houwing

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:

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

Parameters:

Name Description Required
filename Name of the file. Yes

Full UDF Source:

<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>

Search CFLib.org


Latest Additions

Shawn Porter Shawn Porter added
DeMoronize
3 hour(s) ago

Chris Carey Chris Carey added
readPropertiesFi...
1 day(s) ago

Randy Johnson Randy Johnson added
lastDayofWeek
3 day(s) ago

Frank Marion Frank Marion added
sitemapPing
7 day(s) ago

Top Rated

James Sleeman                                     QuickSort
Rated 5.0, 3 time(s)

Barney Boisvert indentXml
Rated 5.0, 3 time(s)

Nathan Dintenfass                                 queryColumnsToSt...
Rated 5.0, 3 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 3 time(s)

Created by Raymond Camden / Design by Justin Johnson