List Files Folders in a Directory in C++ Windows
Below is an example of how to loop over all files and folders in a given location and output the names. #include <Windows.h> int main(int argc, char** argv) { HANDLE hFind = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ffd; hFind = FindFirstFile(TEXT(“C:\\temp\\*”), &ffd); do { Sleep(1000); bool isDirectory = ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; if(isDirectory) { cout