Previous Document Next Document
CorelScriptTools.FileAttr

Function FileAttr(FolderFile As String) As Long

Member of CorelScriptTools

The FileAttr method returns a file’s or folder’s attributes.

Parameter
Description
FileName
Specifyies the file/folder for which the attributes are returned

The FileAttr method returns one of the following values:

  • 0 = file doesn’t 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 read-only, hidden, and a 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 if mysetup.txt was 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.

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.