FileFind
(Engine-Level Function)
Description: | Performs a recursive search down through the directory tree structure and returns an array of matching file names. |
Returns: | Array |
Usage: | Script only. |
Function Groups: | File I/O |
Related to: | FindFile | Dir | DriveInfo | FileDialogBox | GetFileAttribs |
Format: | FileFind(Path, Attributes, Option) |
Parameters: | . |
Path | |||||||||||||||||||||||||||
Required. Any text expression that indicates the full path name where the search begins. This may include a wildcard spec, such as "*.DAT". The search progresses recursively down each sub-directory (depth-first). | |||||||||||||||||||||||||||
Attributes | |||||||||||||||||||||||||||
Required. Any numeric expression that gives the attributes to match on each file listed (files not matching these attributes won't be listed).
Alternatively, the parameter may be constructed by adding together the numbers from the table below:
|
Option | |||||||||||||||||||||||||||||||||
Required. Any numeric expression giving the type of text information to generate. The options are chosen by adding together all of the option numbers required. All information is placed in a single text string, separated by spaces. It will be stored in an element of the array that is created. The information is written from left to right, with lowest option numbers first.
The attributes returned as a result of bit 5 being set are printed as the capital letters A (archive), D (subdirectory), H (hidden), R (read-only), and S (system). |
Comments: |
This function returns an array of text values. As the function does a recursive search through the directory tree, the contents of each sub-directory are added to the array in reverse-alphabetic order before the function moves on to the next directory. |
Example:
If 1 Main; [ FileData = FileFind("C:\VTScada\App\*.DAT", 8, 8); ]
This statement will find all files with the extension "*.DAT" in the given directory regardless of their attributes. The array fileData will contain each file's full path and file name as well as its size and date.