Attributes

Returns the attributes of a file.

Syntax

Attributes

Returns

Integer: containing encoded in it the attributes of the file.

More Information

Attributes values:

  • Read Only – File is set as read only:
  • Hidden – The file or directory is hidden.
  • System – The file or directory is an operation system file or directory.
  • 16- Directory – This item is a directory.
  • 32- Archive – The file or directory is an archive file or directory.
  • 64- Device – Reserved, not to be used.
  • 128 - Normal – The File has no attributes.
  • 256 - Temporary File – This file is marked as being temporary.
  • 512 - Sparse File – This file has the sparse attribute assigned to it.
  • 1024 - Reparse point – the file or directory has an associated reparse point.
  • 2048 - Compressed - The file or directory is compressed.
  • 4096 - Offline – The file has been moved into offline storage and data is not currently available.
  • 8192 - No Index – This file will not be indexed.
  • 16384 - Encrypted – This file is encrypted.

NOTE

If the file has a mixture of these attributes, the value will add to each other. Example an archive which is also read only and hidden, would return a value of 35 (32 for archive, 1 for read only and 2 for hidden).

Example

Displays the attributes of the calc.exe:

Function Main

Dim textfile As Object

Dim att As Integer

Set textfile = File.Connect("127.0.0.1")

If textfile.Open("c:\windows\system32\calc.exe", GENERIC_READ, Open_Existing) Then

att = Textfile.Attributes

echo("Your Calc.exe attribute value is : " & att)

textfile.Close

End If

End Function