CFileFind OneFile; BOOL bWorking = FALSE; long total = 0; if (strPath.Right(1) != "\") { strPath += "\*.*"; } bWorking = OneFile.FindFile(strPath); while (bWorking) { bWorking = OneFile.FindNextFile(); if (OneFile.IsDirectory() && !OneFile.IsDots()) { total++; } } OneFile.Close(); return total;