Hi,
The following example to list all folders under User File Folder:
void FindFolderEx()
{
string strPath = GetAppPath(1); // User File Folder
WIN32_FIND_DATAA FindFileData;
HANDLE hFind = FindFirstFile(strPath + "*.*", &FindFileData);
vector<string> vsFolders;
while(FindNextFile(hFind, &FindFileData))
{
if( strcmp(FindFileData.cFileName, ".") && strcmp(FindFileData.cFileName, "..") )
{
if ( (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) // is Folder, not File
{
vsFolders.Add(FindFileData.cFileName);
}
}
}
printf("%d folders in path %s\n", vsFolders.GetSize(), strPath);
for(int ii=0; ii<vsFolders.GetSize(); ii++)
{
out_str(vsFolders[ii]);
}
}
Iris