zoukankan      html  css  js  c++  java
  • ClearDirectory 删除目录

     ClearDirectory(const char* szPath)
    {
     
     if( szPath == NULL )
      return;
     string strPath = szPath;
     if( strPath.at(strPath.length()-1) != '\\' )
      strPath.append("\\");

     string strSearch = strPath+"*";
     string strTarget;

     WIN32_FIND_DATA FindFileData;
     HANDLE hFind;
     hFind = FindFirstFile(strSearch.c_str(), &FindFileData);
     if (hFind == INVALID_HANDLE_VALUE)
     {
      DWORD dwErr = GetLastError();
      return;
     }
     do
     {
      if( !(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) )
      {
       strTarget = strPath+FindFileData.cFileName;
       DeleteFile(strTarget.c_str());
      }
      else
      {
       if( 0 != strcmp(FindFileData.cFileName, ".") &&
        0 != strcmp(FindFileData.cFileName, "..") )
       {
        strTarget = strPath+FindFileData.cFileName;
        Linkwork::Win32::ClearDirectory(strTarget.c_str());
        RemoveDirectory(strTarget.c_str());
       }
      }
     } while( FindNextFile(hFind, &FindFileData) );
     FindClose(hFind);
     
    }

  • 相关阅读:
    js内置对象
    js对象
    js函数
    js数组
    fetch
    vue按需引入element或mint
    nginx跳转访问
    webstrom vue项目让局域网访问
    Vue+Highcharts完全使用
    HighCharts使用更多图表HighChartsMore
  • 原文地址:https://www.cnblogs.com/ahuo/p/1409474.html
Copyright © 2011-2022 走看看