using System.IO;

DirectoryInfo di = new DirectoryInfo(strXmlFilePath);
FileInfo[] f = di.GetFiles("*.xml");//获取指定扩展名的文件

//没有xml文件
if (f.Length <= 0)
{
     return;
}

//遍历所有文件(*.xml)
foreach (FileInfo myFile in f)
{

}

//遍历所有文件夹

DirectoryInfo[] d = di.GetDirectories();

foreach(DirectoryInfo myDir in d)

{

    string str=myDir.FullName;

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-01-30
猜你喜欢
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2021-10-17
相关资源
相似解决方案