Skip to content

FileSearch

Homes32 edited this page Jan 6, 2024 · 1 revision

FileSearch

Search for a file and return it's full path if it exists. If the file cannot be found an empty string is returned.

Syntax

FileSearch,<Directory>,<File>

Arguments

Argument Description
Directory The directory to search recursively for the specified file.
Filter The name of the file including it's extension to search for. (Ex. MyProgram.exe). Wildcards are supported.

Return Codes

Variable Description
#r One of the following:
Success - A pipe separated list containing the full path(s) to the file.
Fail (File not found) - An Empty String

Remarks

Use List,Get to read the value(s) returned and List,Count to get the number of paths returned.

Related

Examples

Example 1

Search for a file called Resources.dll and return the first path found.


FileSearch,"%ProjectTemp%\%ProgramFolder%","Resources.dll"
If,#r,Equal,"",Halt,"Failed to find [Resources.dll]: The code returned was [#r]."
Else,List,Get,#r,1,%ResPath%