The problems here are when I get the attributes for some reason even though I specify to only add -directorys- to the array it adds every file becasue its looking at them all as directorys. What I want to happen is that it will take only directorys to look through, stores them in a array. Then call the function with those paths. Any help is appreciated. ThanksCode:int findfiles(char *p) { WIN32_FIND_DATA Find; HANDLE hfind; BOOL hfind2; unsigned int i=0; char *dirname[i]; hfind = FindFirstFile(p, &Find); //MessageBox (NULL, Find.cFileName, "first file", 0); if(hfind == INVALID_HANDLE_VALUE){ MessageBox(NULL, "Error opening file", "FindFiles", MB_OK|MB_ICONERROR); } else SendMessage(listbx, LB_ADDSTRING, 0, (LPARAM) Find.cFileName); do{ hfind2 = FindNextFile(hfind, &Find); if(GetFileAttributes(Find.cFileName) & FILE_ATTRIBUTE_DIRECTORY) //MessageBox (NULL, GetFileAttributes(Find.cFileName) , "hey", 0); dirname[i] = new char[strlen(Find.cFileName)] ; dirname[i] = Find.cFileName; MessageBox(NULL, dirname[i], "This is the dir name",0); SendMessage(listbx,LB_ADDSTRING,0,(LPARAM) Find.cFileName); //Sends to listbox. }while(hfind2!=0); FindClose(hfind); for(i=i; i>0;i--) { //nothing happens here although no compile errors. if(i<0) exit(1); findfiles(dirname[i]); } for(i=i;i>0;i--) delete[] dirname[i]; return 0; }





Reply With Quote