标签:style class blog code ext color
1.枚举所有文件夹(递归)
void EnumerateFolders () { WIN32_FIND_DATA fd; HANDLE hFind = ::FindFirstFile (_T ("*.*"), &fd); if (hFind != INVALID_HANDLE_VALUE) { do { if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { CString name = fd.cFileName; if (name != _T (".") && name != _T ("..")) { TRACE (_T ("%s\n"), fd.cFileName); ::SetCurrentDirectory (fd.cFileName); EnumerateFolders (); ::SetCurrentDirectory (_T ("..")); } } } while (::FindNextFile (hFind, &fd)); ::FindClose (hFind); } }
//比如说枚举E:\svn文件夹,不过可能会导致栈溢出
::SetCurrentDirectory(_T("e:\\svn"));
EnumerateFolders();
标签:style class blog code ext color
原文地址:http://www.cnblogs.com/duyy/p/3786165.html