Returns the next filename defined by the search handle.
FileFindNextFile ( search [, flag = 0])
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 handle supplied to FileFindFirstFile(). When @error = 1, no more files found matching the original search handle.
When you have finished searching with the FileFind... functions you must call FileClose() to release the search handle.
Due to the underlying Windows API used (FindFirstFile), this function actually searches both the long and short filenames when looking for matches. If you get unexepected results
then verfiy that it's not the short filename that is being matched.
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Assign a Local variable the search handle of all files in the current directory.
Local $hSearch= FileFindFirstFile ("*.*")
; Check if the search was successful, if not display a message and return False.
If $hSearch= - 1Then
MsgBox ($MB_SYSTEMMODAL,"","Error: No files/directories matched the search pattern.")
Return False
EndIf
; Assign a Local variable the empty string which will contain the files names found.
Local $sFileName= "",$iResult= 0
While 1
$sFileName= FileFindNextFile ($hSearch)
; If there is no more file matching the search.
If @error Then ExitLoop
; Display the file name.
$iResult= MsgBox (($MB_OKCANCEL+ $MB_SYSTEMMODAL),"","File: "&$sFileName)
If $iResult<> $IDOKThen ExitLoop ; If the user clicks on the cancel/close button.
WEnd
; Close the search handle.
FileClose ($hSearch)
EndFunc ;==>Example