Enumerating the folders in a directory tree. 1) Set the current dfirectory. 2) Call the function. All directories beneath will be enumerated. void CEnumDlg::OnEnumerate() { CString str; ::SetCurrentDirectory("c:\\windows"); Enumer(); } char buf[MAX_PATH] = {'\0'}; void CEnumDlg::Enumer() { WIN32_FIND_DATA fd; HANDLE hFind = ::FindFirstFile (_T ("*.*"), &fd); if (hFind != INVALID_HANDLE_VALUE) { do { CString name = fd.cFileName; if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (name != _T (".") && name != _T ("..")) { ::SetCurrentDirectory (fd.cFileName); Enumer(); ::SetCurrentDirectory (_T ("..")); } } if(name != _T (".") && name != _T ("..")) { //Deal with files as you see fit! } } while (::FindNextFile (hFind, &fd)); ::FindClose (hFind); } }