[code]csharpcode:

/// <summary>
	/// 获取文件夹下的文件夹名称列表
	/// </summary>
	/// <param name="path">文件夹路径</param>
	/// <returns></returns>
	public static List<string> Director(string path)
	{
		List<string> fileName = new List<string>();
		DirectoryInfo d = new DirectoryInfo(path);
		
		DirectoryInfo[] directs = d.GetDirectories();//文件夹
		
		//获取子文件夹内的文件列表,递归遍历  
		foreach (DirectoryInfo dd in directs)
		{
			fileName.Add(dd.Name);
		}
		return fileName;
	}
void SlectEXE(){try
			{
				var fles = Directory.GetFiles("文件夹路径", "*.exe");
				foreach (var item in fles)
				{
					//UnityEngine.Debug.Log(item);
					if (item.Substring(item.IndexOf("exe") - 5, 4) == "exe文件后缀")
					{
						ExeFlieName = item;
					}
				}
				if (ExeFlieName != "")
				{//记录进程
					Process process=Process.Start(ExeFlieName);
				}
			}
			catch (System.Exception e)
			{
				UnityEngine.Debug.Log(e.ToString());
			}}

  

posted on 2021-10-09 18:58  陌洛  阅读(37)  评论(0编辑  收藏  举报