Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter SixFile Functions (continued)

GetFirstFile Function

Overview

The GetFirstFile function searches for the first file within a folder that matches a specified name and if a match is found, returns a handle to a Folder Enumeration Object.

Syntax/Parameters

Syntax

handle = GetFirstFile ( string name );

Parameters

name

A string containing a fully qualified path ending in a filename or wildcard mask. The filename portion of the name can include wildcard characters (for example, an asterisk (*) or a question mark (?)). This parameter supports UTF encoding for filenames with Unicode characters.

Return Value

Returns a handle to a Folder Enumeration Object or NULL_HANDLE on failure. Use the GetLastError function to retrieve error information.

Remarks

The GetFirstFile function opens a search object and loads information about the first file with a name that matches the specified pattern. This may or may not be the first file or directory that appears in a directory listing application (such as the “dir” command or in Windows Explorer) when given the same file name string pattern. The GetFirstFile function does not sort the search results.

The Folder Enumeration Object returned by the GetFirstFile function contains the first item in the folder that matches any wildcard match specified or the file if the name parameter contained a filename. In that case, the file specified by the name parameter is the only item in the object. The properties of the item can be retrieved with functions such as the GetFilename and GetFileSize functions. To move to the next entry in the folder, use the GetNextFile function.

Depending on the filename, the wildcard mask, and the file system to which the function is directed, one or two additional folders will be returned: ‘.’, which is the current folder, and ‘..’, which is the parent folder. It is up to the script to determine how to process these entries.

The GetFirstFile function does not currently support UNICODE.

Note: According to the Windows SDK, in rare cases or on a heavily loaded system, file attribute information on NTFS file systems may not be current at the time this function is called.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic