创建多路径文件夹

BOOL CreateMultiDirs(CString xFilePath)
{
    int xFlag=xFilePath.Find(_T("\\"));
    CString s;
    for(int i=0;i<256;i++)
    {
        xFlag=xFilePath.Find(_T("\\"),xFlag+1);
        if(xFlag>3)
        {
            s=xFilePath.Left(xFlag);
            if (!PathFileExists(xFilePath))
            {
                CreateDirectory(s,0);
            }    
        }
        if(xFlag<0)
            return TRUE;
    }
    return FALSE;
}

 

posted @ 2019-05-09 10:23  朱小勇  阅读(287)  评论(0编辑  收藏  举报