# Function Reference

FileFindNextFile

Returns a filename according to a previous call to FileFindFirstFile.

FileFindNextFile ( search )

Parameters

search | The search handle, as returned by FileFindFirstFile.

Return Value

Success: | Returns a filename according to a previous call to FileFindFirstFile.
Failure: | Sets @error to 1 if no more files/directories match the search.

Remarks

A previous call to FileFindFirstFile is necessary to setup the search and get a search handle. Every subsequent call to FileFindNextFile will return the next file found according to the search string supplied to FileFindFirstFile. When @error = 1, no more files found matching the original search string.
When you have finished searching with the FileFind... functions you must call FileClose() to release the search handle.

Related

FileClose, FileFindFirstFile

Example

; Shows the filenames of all files in the current directory
$search = FileFindFirstFile("*.*")
; Check if the search was successful
If $search = -1 Then
MsgBox(0, "Error", "No files/directories matched the search pattern")
Exit
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
MsgBox(4096, "File:", $file)
WEnd
; Close the search handle
FileClose($search)