zoukankan      html  css  js  c++  java
  • RemoveDirectoryB

     

    删除非空文件夹

    实现过程


     

     

    void RemoveDir(CString szPath)
    {
        CFileFind ff;
        
        if(szPath.Right(1) != "\\")//目录的最右边需要“\”字符
            szPath += "\\";
        szPath += "*.*";
        BOOL res = ff.FindFile(szPath);
        while(res)
        {
            res = ff.FindNextFile();
            if (!ff.IsDots() && !ff.IsDirectory())
                DeleteFile(ff.GetFilePath());
            else if (ff.IsDots())
                continue;
            else if (ff.IsDirectory())//为目录
            {
                szPath = ff.GetFilePath();
                RemoveDir(szPath);
                RemoveDirectory((LPCTSTR)szPath);
            }
        }
    }
        
    void CSssDlg::OnOK() 
    {
        CString folder="C:\\Users\\Administrator\\Desktop\\A";
        RemoveDir(folder);    
        if(RemoveDirectory((LPCTSTR)folder))
        {
          AfxMessageBox("删除成功!");
        }
    }


     

     

     


     

    备注

     

     

    相关链接

         

     

     




  • 相关阅读:
    Vue中computed和watch的区别
    JS基础语法
    JDBC
    表设计
    查询语句
    反射
    网络端
    多线程
    HashMap
    IO
  • 原文地址:https://www.cnblogs.com/xe2011/p/2923681.html
Copyright © 2011-2022 走看看