Searching for One or More Files

An application can search the current directory for all file names that match a given pattern by using the FindFirstFile, FindFirstFileEx, FindNextFile, and FindClose functions. The pattern must be a valid file name and can include wildcard characters.

The FindFirstFile and FindFirstFileEx functions create handles that FindFirstFileEx uses to search for other files with the same pattern. All functions return information about the file that was found. This information includes the file name, size, attributes, and time.

The FindFirstFileEx function also allows an application to search for files based on additional search criteria. The function can limit searches to device names or directory names.

The FindClose function destroys handles created by FindFirstFile and FindFirstFileEx.

An application can search for a single file on a specific path by using the SearchPath function.