---
url: >-
  /statelake/scripting-reference/functions-and-procedures/file-functions/fileisreadonly.md
---

# FileIsReadOnly

The function **FileIsReadOnly** asks a question - whether the file named by the parameter **FileName** is a property of **ReadOnly** or not.

It returns a boolean result of **True** if the file is **ReadOnly**, or **False** if it is not.

The **FileName** must include the full path.

Please also review the function [RemoveReadOnly](/statelake/scripting-reference/functions-and-procedures/file-functions/removereadonly).

**Declaration**: Function FileIsReadOnly(const FileName : string) : Boolean

To try this simple example, substitute your own file names and paths.

```pascal
procedure ScriptEvent (var Value : variant);
 var ConfYN : boolean;
begin
 //This first file is not set to ReadOnly
  ConfYN := FileIsReadOnly('c:\Temp\NotSetToReadOnly.txt');
 If ConfYN = true then
    LogInfo('The file is READ only')
 else
    LogInfo('The file is not READ only');

 //This 2nd file has been set to ReadOnly
  ConfYN := FileIsReadOnly('c:\Temp\SetToReadOnly.txt');
 If ConfYN = true then
    LogInfo('The file is READ only')
 else
    LogInfo('The file is not READ only');
  LogInfo('');
end;
```
