Click to See Complete Forum and Search --> : Find Directory


joscollin
July 25th, 2003, 07:58 AM
Hi,

I want to find whether the filenames listed by the MessageBox in the following code are directory names or not.

thanks
collin

int CClientDrives::GetFilesFromFolder(char *folderPath)
{


WIN32_FIND_DATA finddata;
strcat(folderPath,"\\*.*");

HANDLE hSearch = FindFirstFile(folderPath, &finddata);


if(hSearch != INVALID_HANDLE_VALUE)
{
while(FindNextFile(hSearch, &finddata))
{
if(strcmp(finddata.cFileName, ".."))
{
MessageBox(NULL, finddata.cFileName, NULL, 0);






}


}
}

FindClose(hSearch);
return 0;


}

AvDav
July 25th, 2003, 02:27 PM
Hello.
if(finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
//it's a directory
}