Clarifying the documentation on wildcards accepted by FindFirstFile/FindFirstFileEx

Raymond Chen

A customer asked for clarification in the documentation for Find­First­File and related functions, such as Find­First­File­Ex and Find­First­File­Transacted

Does Find­First­File­Ex support multiple wildcards in the lpFile­Name parameter? The documentation is not clear. We are hoping to pass something like C:\Directory1\Directory2\*abc*\def*.txt. Note that there are two asterisks in the directory portion as well as an asterisk in the file name portion. Should we expect this to work? The documentation is not very explicit about this scenario. It just says

lpFileName: The directory or path, and the file name, which can include wildcard characters, for example, an asterisk (*) or a question mark (?).

I agree that the documentation is ambiguous here. One interpretation of the sentence is

The directory or path, and the file name, any of which can include wildcard characters, for example, an asterisk (*) or a question mark (?).

Or it could be interpreted as

The directory or path, and the file name. The file name can include wildcard characters, for example, an asterisk (*) or a question mark (?).

You can have multiple wildcards, but all wildcards must exist in the file name portion. The search pattern lets you apply a filter to a search within a single directory. It is not a SQL query.

I submitted a documentation change request to clarify the sentence to the second version above:

The directory or path, and the file name. The file name can include wildcard characters, for example, an asterisk (*) or a question mark (?).

0 comments

Discussion is closed.

Feedback usabilla icon