void ScanFile(CString Dir)
{CFileFind finder;CString Add=L"\\*";CString DirSpec=Dir+Add; //补全要遍历的文件夹的目录BOOL bWorking = finder.FindFile(DirSpec);while (bWorking){bWorking = finder.FindNextFile();if(!finder.IsDots()) //扫描到的不是节点{if(finder.IsDirectory()) //扫描到的是文件夹{CString strDirectory = finder.GetFilePath();ScanFile(strDirectory); //递归调用ScanFile()}else //扫描到的是文件{//CString strFile = finder.GetFilePath(); 得到文件的全路径//进行一系列自定义操作}}}finder.Close();
}