文件遍历

void FindFile(CString strPath)//find all files in strPath
{
    CString            strTemp;
    CFileFind        fileFinder;

    BOOL    bIsFinded    = fileFinder.FindFile(strPath+_T("\\*.*"));
    while (bIsFinded)
    {
        bIsFinded = fileFinder.FindNextFile();

        if(!fileFinder.IsDots())
        {
            strTemp    = fileFinder.GetFilePath();
            if(fileFinder.IsDirectory())//文件夹,递归查找
                FindFile(strTemp);
           else//文件
           {
                string infile=CStringToString(strTemp); //将CString转为标准string     
           }
        }

    }
    fileFinder.Close();
}

你可能感兴趣的:(文件遍历)