CFLib.org – Common Function Library Project

FileSetReadOnly(filename)

Last updated November 15, 2002

author

Jesse Houwing

Version: 1 | Requires: CF6 | Library: FileSysLib

Description:
Makes a file ReadOnly. WARNING: there is no way to make it writable again from Coldfusion. It uses the standard Java File object, which makes it very fast under Coldfusion MX.

Return Values:
Returns nothing.

Example:

<!---
<cfset filename="c:\autoexec.bat">
<cfset FileSetReadOnly(filename)>
--->

Parameters:

Name Description Required
filename Filename to use. Yes

Full UDF Source:

/**
 * Makes a file ReadOnly.
 * 
 * @param filename      Filename to use. (Required)
 * @return Returns nothing. 
 * @author Jesse Houwing (j.houwing@student.utwente.nl) 
 * @version 1, November 15, 2002 
 */
function FileSetReadOnly(filename){
    var _File =  createObject("java", "java.io.File");
    _File.init(JavaCast("string", filename));
    _File.setReadOnly();
}

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