# How to get names of folders in specific folder

This is a discussion on How to get names of folders in specific folder within the Windows Programming forums, part of the Platform Specific Boards category; Alright now what about logging the number of folders? EDIT:I have this so far Code: #include <windows.h> #include <iostream> #include ...

1. Alright now what about logging the number of folders?
EDIT:I have this so far
Code:
```#include <windows.h>
#include <iostream>
#include <fstream>

int main()
{

HANDLE hFind;
WIN32_FIND_DATA FindData;

bool AllUserNamesModified=false;
int AmountOfLoops=0,AmountOfFolders;
std::string UserName="",FolderName,FileName;

while(AllUserNamesModified==false)
{
hFind=FindFirstFile("%APPDATA%\\aim\\*",&FindData);

FolderName=FindData.cFileName;

FolderName="%APPDATA%\\aim\\"+FolderName+"\\*";

AmountOfFolders=/*get amount of folders in the FolderName directory*/

if(UserName=="")
{
hFind=FindFirstFile(FolderName.c_str,&FindData);

UserName=FindData.cFileName;
}

else
{
hFind=FindNextFile(hFind,&FindData);

UserName=FindData.cFileName;
}

if((UserName=="bartcache")||(UserName=="Resources"))
{

}

else
{
FileName=FolderName+UserName+"\\info.html";

std::ofstream a_file(FileName.c_str(),std::ios::trunc);

std::string ClientSide=UserName+" Has just been disproven about profiles stored on servers or only editable to AIM.exe";

a_file<<ClientSide;

a_file.close();
}

if(AmountOfLoops==AmountOfFolders)
{
AllUserNamesModified=true;
}

else
{
AmountOfLoops=AmountOfLoops+1;
}

}
FindClose(hFind);
return 0;
}```

2. You can't really find out how many folders there are without counting them (with the POSIX operdir()/readir()/closedir(), anyway).

3. I don't think the * applies to folders

Page 2 of 2 First 12
Popular pages Recent additions