FindFile is a built-in scripting function that searches for all files that match a given search string.
Function | Group | Execution | Windows | Embedded | Thin Client |
---|---|---|---|---|---|
FindFile | File | Synchronous | Supported | Supported | Supported |
You may use wildcards (*) to find multiple files. For example, *.gif to find all GIF files or log*.txt to find all log files in a sequence (e.g., log001.txt, log002.txt, log003.txt).
\\volume name or IP address\Logs\log*.txt…then the function will search the Logs directory on the specified network volume.
This is an optional parameter. If no value is specified, then the file names will not be saved and the function will only return the number of files found. For more information, see "Returned value" below.
This is an optional parameter. If no value is specified, then the project will continue searching until it has completely searched the specified directory.
Value | Description |
---|---|
-1 | Function timed out. |
0 | No matching files found. |
n | Number of matching files found. |
This function may be called by any project client, but it is always executed on the project server. By default, it only searches the server's project folder, and if strFile includes a relative file path, then it must be relative to the that same directory.
Furthermore, because the function is executed synchronously on the project server, if strFile is poorly defined and/or optNumTimeout is not used, then the entire project — both the server and the clients — may hang while it searches for the files.
Finally, optNumTimeout is not supported if the project server is a Windows Embedded device.
FindFile( "*.txt" )
FindFile( "*.doc", "StringArray", 1000 )