Get all sub files and sub folder information in the specified path folder

From , 5 Years ago, written in C#, viewed 144 times.
URL https://pastebin.vip/view/2aedcba6
  1. /// <summary>
  2. /// 获取指定路径文件夹中所有子文件及子文件夹信息
  3. /// </summary>
  4. /// <param name="strPath"></param>
  5. public void getAll ( string strPath )
  6. {
  7.         //获取指定路径文件夹中所有子目录名称
  8.         string[] myDirsName = Directory.GetDirectories ( strPath );
  9.         foreach ( string strDirName in myDirsName )
  10.         {
  11.                 labResult.Text += "\n" + strDirName;
  12.                 getAll ( strDirName ); //递归调用getAll()方法,继续遍历子文件夹中的所有文件及文件夹信息
  13.         }
  14.         //获取指定路径文件夹中所有子文件名称
  15.         string[] myFilesName = Directory.GetFiles ( strPath );
  16.         foreach ( string strFileName in myFilesName )
  17.         {
  18.                 labResult.Text += "\n" + strFileName;
  19.         }
  20. }
  21.  

Reply to "Get all sub files and sub folder information in the specified path folder"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website