Description

Returns directory information (size, date, and time) for an operating system file.

Syntax

data = Dir (filename)

Parameters

The Dir function has the following parameters.

ParameterDescription
filenameFull name (including path, if appropriate) of the operating system file.

The Dir function returns the same information about an operating system file as is typically displayed in an operating system Dir command. This includes the size of the file and the date and time the file was last updated.

Dir returns a three-element dynamic array of file information (@FM-delimited), using this layout:

<1> File size in bytes

<2> Last update date (in OpenInsight internal format)

<3> Last update time (in OpenInsight internal format)

You can convert the internal forms of the date and time to external format using the OConv function.

See also

DirList()InitDirDate()Time(). For more information about directories and path names, refer to your operating system manual.

Example

* Returning information about an operating system file.
/* Reads directory information for the AUTOEXEC.BAT file. 
The file_size is assigned the file size, 
while last_update_date and last_update_time are assigned the date and time, 
converted to external format. */
file_info = Dir("C:\AUTOEXEC.BAT")
file_size = file_info<1>
last_update_date = OConv(file_info<2>, "D2-")
last_update_time = OConv(file_info<3>, "MTH")
  • No labels