Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter SixFile Functions (continued)

EnumerateFiles Function

Overview

The EnumerateFiles function will recursively search folders using a specified path and wildcard mask and return an array of filenames.

Syntax/Parameters

Syntax

string[] = EnumerateFiles ( string path, [dword flags] );

Parameters

path

A string containing a qualified path and wild card match. The path can contain an ending backslash, a *.* or another matching wildcard pattern. If a wildcard is not present, *.* is assumed. Multiple wildcards can be used by separating the terms with a semicolon. For example, “*.txt;*.htm”.

flags

An optional dword specifying flags. If the parameter is omitted, the default value is FOLDER_LOAD_RECURSE.

  Defines   Bitwise   Description  
  Append Flags:          
    FOLDER_LOAD_NO_RECURSE     0x00000000   No Recurse (absence of flag)  
    FOLDER_LOAD_RECURSE   0x00000001   Recurse into subdirectories  
    FOLDER_LOAD_FOLDER_TO_BRACKETS   0x00000002   Add brackets to directory names  
    FOLDER_LOAD_FOLDER_NAMES   0x00000004   Add folder names  
    FOLDER_LOAD_RECENT_30   0x00000008   Load only past 30 days  
    FOLDER_LOAD_NO_FOLDER_NAV   0x00000010   Skip the '.' and '..' entries  
    FOLDER_LOAD_NO_HIDDEN   0x00000020   Do not load hidden files  
    FOLDER_LOAD_NO_SYSTEM   0x00000040   Do not load system files  
    FOLDER_LOAD_CASE_SENSITIVE   0x00000080   Match case-sensitive  
    FOLDER_LOAD_MATCH_FOLDERS   0x00000100   Apply Mask to Folder Names  
  Files:        
    FOLDER_UTF_NAMES   0x00001000   Contain UTF coded name (Unicode)  
  Operation:        
    FOLDER_USE_PROGRESS   0x00100000   Use Legato's Progress Display  

 

Note that since this function does not enumerate folders, the related folder bits do not result in an output change.

 Return Value

Returns a string array of filename and relative paths as appropriate or an empty array on failure. Use the GetLastError function to retrieve error information.

The return values will be UTF encoded for filenames with Unicode characters.

Remarks

Because an empty array could indicate either an error or the lack of any matching result, the GetLastError function should be used to determine if an error occurred. This function does not enumerate folder names. Use the EnumerateFolders function to enumerate matching folder names.

Note that is function can require a fair amount of processing time, particularly if recursing through folders.

Note that wildcard matching within the script language (and the Windows SDK) operates differently from the Windows Explorer Search, File Browse Filters and the command promot ‘dir’ command, all of which employ loose filename matching.

Related Functions

Platform Support

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

Legato IDE, Legato Basic