unity 通過程式碼查詢一個資料夾下的所有檔案
阿新 • • 發佈:2019-02-10
//路徑 string fullPath = "Assets/Models/21/21000001" + "/"; //路徑 //獲取指定路徑下面的所有資原始檔 if (Directory.Exists(fullPath)){ DirectoryInfo direction = new DirectoryInfo(fullPath); FileInfo[] files = direction.GetFiles("*",SearchOption.AllDirectories); Debug.Log(files.Length); for(int i=0;i<files.Length;i++){ if (files[i].Name.EndsWith(".meta")){ continue; } Debug.Log( "Name:" + files[i].Name ); //打印出來這個檔案架下的所有檔案 //Debug.Log( "FullName:" + files[i].FullName ); //Debug.Log( "DirectoryName:" + files[i].DirectoryName ); } }
http://blog.csdn.net/u014370148/article/details/69261110--轉這位部落格主 非常感謝!