FindFirstFile is not a SQL query
FindFirstFile function is not a SQL query. It’s a very simple directory enumerator. There is a slightly fancier version called
FindFirstFileEx, but even that function doesn’t add much at present beyond filtering for directories or devices.
You don’t get to pass it sort criteria like or “return the files/directories sorted smallest file first”, or “return the files/directories in reverse order of creation” The only filtering you can provide are the wildcard pattern and (if you use
FindFirstFileEx) a directory filter. The wildcard language is very limited as well; it can’t express queries like “files whose extension are either .exe or .dll” or “all files whose extension is .c plus all directories regardless of extension“. You also can’t ask it questions like, “Tell me the total size of the files in this directory”, for as we saw earlier, this question is underspecified.
If you want to do any of those advanced queries, you’ll have to code it up yourself. Or as Hippie Tim is fond of saying, “Start typing!”