Share via:

AutoIt FileFindFirstFile Function

Search for files, and directories with the FileFindFirstFile function.


Edited: 2017-03-26 15:10

The AutoIt FileFindFirstFile function is used to search for files and directories.

The search string is not case sensitive.

The * wildcard means zero or more files, while the question mark ? means zero or one file. *.* will return a list of both files and directories. Wildcards can only be used in the filename, or the file extension parts.

Using a 3-char extension will match any files beginning with those 3 characters, but using 2-char extensions will only list files with exactly that. This means that you might want to filter the result further with regular expressions.

The below script will return all .au3 files in the same directory as the script it self, and then close the search handle using the FileClose function.

$search = FileFindFirstFile("*.au3")

While 1
    Local $file = FileFindNextFile($search)
    If @error Then ExitLoop

    MsgBox(4096, "File:", $file)