CFLib.org – Common Function Library Project

FileCanWrite(filename)

Last updated November 14, 2002

author

Jesse Houwing

Version: 1 | Requires: CF6 | Library: FileSysLib

Description:
Checks to see if a file can be written to. It uses the standard Java File object, which makes it very fast under Coldfusion MX.

Return Values:
Returns a boolean.

Example:

<cfset filename="c:\autoexec.bat">
<cfoutput>
    Can write to: #FileCanWrite(filename)#<br>
</cfoutput>

Parameters:

Name Description Required
filename The name of the file. Yes

Full UDF Source:

/**
 * Checks to see if a file can be written to.
 * 
 * @param filename      The name of the file. (Required)
 * @return Returns a boolean. 
 * @author Jesse Houwing (j.houwing@student.utwente.nl) 
 * @version 1, November 14, 2002 
 */
function FileCanWrite(filename){
    var daFile = createObject("java", "java.io.File");
    daFile.init(JavaCast("string", filename));
    return daFile.canWrite();
}

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

Created by Raymond Camden / Design by Justin Johnson