创建多级文件夹

void myCreateDirectory(CString source)
{

    CString path;
    int pre_pos=source.Find(_T("\\"));
    int pos=0;
    path=source.Mid(pre_pos+1);  
        CString create;
    pos=path.Find(_T("\\"));
    while(pos!=-1)
    {
        path=path.Mid(pos+1);
        pre_pos+=pos+1;
        create=source.Left(pre_pos);
        CreateDirectory(create,NULL);
        pos=path.Find(_T("\\"));
    }
    create+=_T("\\")+path;
    CreateDirectory(create,NULL);

}

 

posted @ 2014-01-02 15:47  风刮过冷  阅读(174)  评论(0编辑  收藏  举报