Object Model Reference : Classes : C : CorelScriptTools : Methods : CorelScriptTools.FileAttr |
Function FileAttr(FolderFile As String) As Long
Member of CorelScriptTools
The FileAttr method returns the attributes for a file or folder.
The FileAttr method returns one of the following values:
• |
0 = file doesnt exist
|
• |
1 = read-only files or folder
|
• |
2 = hidden files or folder
|
• |
4 = system files or folder used by operating system
|
• |
16 = folder
|
• |
32 = archive files or folder
|
• |
128 = normal files or folder
|
• |
256 = temporary files or folder
|
• |
2048 = compressed files and folders
|
If mysetup.txt is a read-only, hidden system file, retval equals 7:
retval = FILEATTR("C:\myfiles\mysetup.txt") |
In cases where multiple attributes are returned, you can use the AND operator to determine specific attributes. To determine whether mysetup.txt is a read-only file, you could use the following syntax:
IF 1 AND retval THEN readOnly$ = "Yes" ELSE readOnly$ = "No" |
1 is the read-only attribute. The variable readOnly is assigned a string based on bitwise comparison. In this case, readOnly is assigned Yes.
Copyright 2013 Corel Corporation. All rights reserved.