Skip to content

StatFileSystemObject (file/dir)

ts
function StatFileSystemObject(what: string): DirListItem;

Returns the stat information for the file or directory specified by what in the local file system. If the object does not exist, the returned DirListItem will be empty.

ParameterTypeRequirementExplanation
whatstringrequiredPath to a valid, existing file or directory in the local file system

Example return value

json
{
  "Name": "testfile.txt",
  "Type": "FILE",
  "Size": 1777,
  "TimeStamp": "2026-08-25T09:05:30.771369704-07:00"
}

NOTE

Name here is the bare file name, unlike ListDir, which sets it to the fully qualified path. TimeStamp is a timestamp value rather than a number: pass it to ToDate() or to FormatDateTime(), both of which read it directly.

TIP

A non-existent path returns an empty DirListItem rather than raising an error, so test info.Name !== "" before using the result.