zoukankan      html  css  js  c++  java
  • 遍历某目录下所有文件和文件夹

    遍历某路径下所有文件夹和文件

    使用CFileFind类实现,其头文件为afx.h.

    获得当前可执行文件的路径:

    TCHAR   exeFullPath[100];

           GetModuleFileName(NULL,exeFullPath,100);

     

    获取当前可执行文件所在文件夹:

    CString   sName;

           sName.Format( _T("%s "),exeFullPath);///当前文件全路径名。

           int n  = sName.ReverseFind( '\\');

           sName=sName.Left(sName.ReverseFind( '\\') + 1);///去除文件名部分。

    CFileFind::IsDots

    Nonzero if the found file has the name "." or "..", which indicates that the found file is actually a directory. Otherwise 0.

    采用递归的方法进行遍历:


  • 相关阅读:
    python函数及模块
    Python分支结构及循环结构
    python基本的知识
    11.21学习总结
    进度日报28
    进度日报27
    进度日报26
    进度日报25
    进度日报24
    11.14学习总结
  • 原文地址:https://www.cnblogs.com/johnpher/p/2570710.html
Copyright © 2011-2022 走看看