19,469
社区成员
发帖
与我相关
我的任务
分享
void Recurse(LPCTSTR pstr)
{
CFileFind finder;
// build a string with wildcards
CString strWildcard(pstr);
strWildcard += _T("\\*.*");
// start working for files
BOOL bWorking = finder.FindFile(strWildcard);
while (bWorking)
{
bWorking = finder.FindNextFile();
// skip . and .. files; otherwise, we'd
// recur infinitely!
if (finder.IsDots())
continue;
// if it's a directory, recursively search it
CString str = finder.GetFilePath();
if (finder.IsDirectory())
{
Recurse(str);
}
else
{
if(0 == str.Right(3).CompareNoCase(_T("jpg")))
TRACE(_T("%s\n"), (LPCTSTR)str);
}
}
finder.Close();
}
void PrintDirs()
{
Recurse(_T("F:"));
}