FileInfo(fileName)
Last updated October 15, 2002
Version: 1 | Requires: CF6 | Library: CFMLLib
Description:
Returns information about a file. This includes: attributes, datelastmodified, mode, name, size, and type.
Return Values:
Returns a query.
Example:
<cfscript>
x=fileInfo(expandPath(".") & "\" & listLast(cgi.script_name,"/"));
</cfscript>
<cfdump var="#x#" label="File Info">
Parameters:
Name | Description | Required |
---|---|---|
fileName | File to inspect. | Yes |
Full UDF Source:
<!---
Returns information about a file.
Updated for CMFX var scope.
@param fileName File to inspect. (Required)
@return Returns a query.
@author Raymond Camden (ray@camdenfamily.com)
@version 1, October 15, 2002
--->
<cffunction name="fileInfo" output="false" returntype="query">
<cfargument name="fileName" type="string" required="true">
<cfset var directory = "">
<cfset var getFile = queryNew("")>
<cfif not fileExists(fileName)>
<cfthrow message="fileInfo error: #fileName# does not exist.">
</cfif>
<cfset directory = getDirectoryFromPath(fileName)>
<cfdirectory name="getFile" directory="#directory#" filter="#getFileFromPath(fileName)#">
<cfreturn getFile>
</cffunction>
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016