Skip to main content

FileAttr

property FileAttr: Integer read

Example

procedure ScriptEvent(var Value: variant);
begin
Files.Search('C:\VeloxExamples\Inbound', '*', $1FF);
try
if Files.Exists then
Value := Files.FileAttr
else
Value := 0;
finally
Files.Close;
end;
end;

Usage

FileAttr returns the current search entry's Windows file-attribute bitmask, or zero when the cursor has no current entry.

Value

When Exists is true, the property returns TSearchRec.Attr, populated on Windows from WIN32_FIND_DATAW.dwFileAttributes. When no current entry exists, it returns 0.

Common Velox/Windows bits include:

BitMeaning
$1read-only
$2hidden
$4system
$10directory
$20archive
$80normal
$100temporary
$400symbolic link/reparse entry in Velox's mapped value
$800compressed
$4000encrypted
$10000

Test a bit with Files.FileAttr and BitValue <> 0. Do not compare the complete value to one constant because multiple attributes can coexist.

Behaviour

The value describes the current directory entry at enumeration time. It can change after Next or any other operation that replaces the cursor. It is useful for distinguishing directories when a search includes them, but it is not an access-control decision and does not prove that a subsequent operation will succeed.

Additional Technical Info

FileAttr is the read-only attribute bitmask for the helper's current search entry.

Implementation

The getter returns the Attr field unchanged behind an Exists guard. It does not call GetFileAttributes, follow links, refresh stale metadata or translate the value into a script set.

Edge cases and quirks

  • 0 can mean no current entry. It must not be interpreted as a confirmed normal file unless Exists is true.
  • The Search attribute argument controls inclusion of special entries; it does not require returned entries to have every supplied bit.
  • Reparse/symbolic-link attributes describe the directory entry. Copy/move behavior is determined separately by the Windows operation and flags.
  • Windows notes that enumerated NTFS attributes can occasionally be stale under load.

Performance and concurrency

The getter is constant-time and performs no I/O. The record has no synchronization and may be replaced concurrently.

Related entries

  • Search explains the different semantics of its aSearchAttr inclusion argument.
  • FileName returns the name associated with this bitmask.

External references

Created 2026-07-15