By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

AutoIt FileFindFirstFile Function

Reference on the AutoIt FileFindFirstFile Function. This function is used to search for files in a directory.

Edited: 2015-02-13 00: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.

AutoIt FileFindFirstFile Example

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)