Skip to content

Instantly share code, notes, and snippets.

@satojkovic
Last active December 18, 2015 03:39
Show Gist options
  • Save satojkovic/5719884 to your computer and use it in GitHub Desktop.
Save satojkovic/5719884 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <windows.h>
int main()
{
WIN32_FIND_DATA FindDirData;
std::string targets = "C:\\*";
HANDLE hFind = FindFirstFile(targets.c_str(), &FindDirData);
do {
if( hFind != INVALID_HANDLE_VALUE ) {
if( strcmp(FindDirData.cFileName, ".") && strcmp(FindDirData.cFileName, "..") ) {
if( FindDirData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {
std::cout << "Directory: " << FindDirData.cFileName << std::endl;
}
else {
std::cout << "Not Directory: " << FindDirData.cFileName << std::endl;
}
}
}
} while( FindNextFile(hFind, &FindDirData) );
FindClose(hFind);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment