SetReadOnly(sFilePath, bReadOnly)
Last updated September 27, 2001
Version: 1 | Requires: CF5 | Library: FileSysLib
	Description: 
	Convenience function to set/clear the ReadOnly attribute for the specified file.
	Return Values: 
	Returns a Boolean value indicating whether the attribute was set.
Example:
<CFSET x = SetReadOnly("c:\myfile.txt", "Yes")>
<CFOUTPUT>
Was the attribute set? #YesNoFormat(x)#
</CFOUTPUT>
Parameters:
| Name | Description | Required | 
|---|---|---|
| sFilePath | Absolute or relative path to the specified file. | Yes | 
| bReadOnly | Boolean value indicating whether the attribute should be read only (Yes) or (No). | Yes | 
Full UDF Source:
/**
 * Convenience function to set/clear the ReadOnly attribute for the specified file.
 * Uses COM. This is a Windows only funciton. Requires CFOBJECT be enabled in the CF Administrator. This function depends on the SetFileAttribute() function in this library. See the SetFileAttribute() function for details.
 * 
 * @param sFilePath      Absolute or relative path to the specified file. 
 * @param bReadOnly      Boolean value indicating whether the attribute should be read only (Yes) or  (No). 
 * @return Returns a Boolean value indicating whether the attribute was set. 
 * @author Nate Weiss (nate@nateweiss.com) 
 * @version 1, September 27, 2001 
 */
function SetReadOnly(sFilePath, bReadOnly) {
   return setFileAttribute(sFilePath, "ReadOnly", bReadOnly);
 };
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