IsFileReadOnly
Tests the read only attribute of a file.
Member of namespace
FileIOSyntax
bool IsFileReadOnly (string filename, bool testForReadOnly)
Parameters
- filename
- Type: string
- testForReadOnly
- Type: bool
Parameters
- filename : The file name and path of the file to test. Smart parameters are allowed.
- testForReadOnly : Determines if the action should return true for read-only or read-write.
Returns
If testForReadOnly is True, the action returns True if the file is read only.If testForReadOnly is False, the action returns True if the file is not read only.
If an error occurs, or if the file does not exist, the action returns False.
Level
All levels.Details
This action will indicate if a file is set to read only.- Example
IsFileReadOnly("c:\mydir\myfile.txt", true)if the file myfile.txt is set to read only, the action returns True.
IsFileReadOnly("c:\mydir\myfile.txt", false)if the file myfile.txt is not set to read only, the action returns True.