File Searching API functions
Please bare with me here, I have a couple questions I've been saving up on file searching functions on MSDN:
I've been browsing MSDN in the file management section looking for good solutions for finding files in directories by file name AND attributes, but have not found one yet. I am trying to implement a file search that would search through a directory and find only subdirectories, but since FindFirstFile will only search by name and not by attribute, the only solution I can think of is manually stepping through each file in the directory and checking if it has the FILE_ATTRIBUTE_DIRECTORY flag set... which seems a bit ineffecient. Is there any other function/method I could implement to find only subdirectories within a directory?
Also, complementary to the above problem, I am trying to find a function that will return the number of files contained in a directory (without having to manually step through counting as in the above example). Is there something like a "GetNumberOfFilesInDirectory"?
Thirdly, I also need to obtain the last access time of a directory, and thought GetFileAttributesEx() would be a good way to do this, except it states here (GetFileAttributesEx()) that the fLastAccessTime member "For a directory, ... specifies when the directory is created." Now, I'm hoping this is a typo because I'm finding it hard to believe they would store the creation time in anything but the fCreationTime member, and would reserve the fLastAccesTime member for.. well... what its named for!!
My final question is on recursive directory searching. Is there any API function that will recursively search a directory and all subdirectories for a specified file/directory? I was thinking of creating a FindFirstFile recursive function, but was hoping microsoft might have already supplied one, any luck?
Thanks for reading and any of your suggestions!