CFileFind finder; BOOL bFind = finder.FindFile(strFilePath); while (bFind) { bFind = finder.FindNextFile(); VString strSubPath = finder.GetFilePath(); VString strFileName = finder.GetFileName(); if (finder.IsDots() || finder.IsHidden()) continue; if (finder.IsDirectory() && bRecurse) // 是否递归查找子目录s { // 是子目录 你的行为 } if (!finder.IsDirectory()) { // 获取相对路径 strSubPath = _vfxFileGetRelativePath(m_strRootPath, strSubPath); // 把路径全部转换成小写 使用正则表达式时才能匹配 // 不能只转换文件名在拼接路径 eg. win/Common.dll 在makelower后还是原来的路径 // 如果转换文件名再拼接就变成 win/common.dll 正则表达式匹配会失败 strSubPath.MakeLower(); // map.insert(std::make_pair<VString, int>(strSubPath, 1)); } }