CFLib.org – Common Function Library Project

FileType(path)

Last updated July 24, 2001
Download UDF

author

Rob Brooks-Bilson                                 Rob Brooks-Bilson

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

 
Rated 0 time(s). Average Rating: 0

Description:
Returns a string corresponding to the type of file specified. Because this function uses COM, it is only supported in the Windows version of ColdFusion.

Return Values:
Returns a string.

Example:

<CFSET TheFile = "c:\winnt\notepad.exe">
<CFOUTPUT>
The file #TheFile# is a(n) <I>#FileType(TheFile)#</I>.
</CFOUTPUT>

Parameters:

Name Description Required
path Absolute or relative path to the specified file. Yes

Full UDF Source:

<cfscript>
/**
* Returns a string corresponding to the type of file specified. (Windows only)
*
* @param path      Absolute or relative path to the specified file.
* @return Returns a string.
* @author Rob Brooks-Bilson (rbils@amkor.com)
* @version 1.0, July 24, 2001
*/

function FileType(path)
{
Var fso = CreateObject("COM", "Scripting.FileSystemObject");
Var theFile = fso.GetFile(path);
Return theFile.Type;
}
</cfscript>

Search CFLib.org


Latest Additions

Tony Felice Tony Felice added
writeStateSelect
14 hour(s) ago

Tony Felice Tony Felice added
varNameToText
15 hour(s) ago

Larry C. Lyons Larry C. Lyons added
splitMX
15 hour(s) ago

Tony Felice Tony Felice added
listIsItemSimila...
15 hour(s) ago

Tony Felice Tony Felice added
listCountItemSim...
15 hour(s) ago

Top Rated

Rob Brooks-Bilson                                 ListCompare
Rated 5.0, 6 time(s)

Nathan Dintenfass                                 QueryStringChang...
Rated 5.0, 4 time(s)

Rob Brooks-Bilson                                 FormatSSN
Rated 5.0, 2 time(s)

Ben Forta                                         DollarAsString
Rated 5.0, 2 time(s)

Ed Hodder                                         CapFirstTitle
Rated 5.0, 2 time(s)

Created by Raymond Camden / Design by Justin Johnson