Home > Language Reference > File Functions > FileAttr$

FileAttr$

The FileAttr$ function returns the attributes of the specified file.

Usage

Used to know the attributes of a file.

Syntax

var$=FileAttr$(<filename>)

Parameters

<filename>, string, name of the file. It can be too a folder name.

Return value

var$, string, attribute of <filename>. The possible values are:
Return value   Attribute description
 N  No attribute
 D  Folder
 R  Read only
 H  Hidden
 A  Archive
 S  System


If the function cannot retrieve the attribute, the return value is an empty string and script execution stops (unless #IgnoreErrors=1). 

See also

DirTree
SetAttr

Example

filename$="c:\program files (x86)\ wintask \logs\untitled1.log"
attr$=FileAttr$(filename$)
msgbox(attr$)