public static void CopyFile()
{
//路径
string filepath = Application.dataPath + "/Lua/";
string destPath = Application.streamingAssetsPath + "/Lua/";
//获取指定路径下面的所有资源文件
if (Directory.Exists(filepath))
{
DirectoryInfo direction = new DirectoryInfo(filepath);
FileInfo[] files = direction.GetFiles("*", SearchOption.AllDirectories);
string path = "";
for (int i = 0; i < files.Length; i++)
{
if (files[i].Name.EndsWith(".meta"))
{
continue;
}
path = destPath + files[i].FullName.Replace("\\", "/").Replace(filepath, "").Replace(files[i].Name,"");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
File.Copy(filepath + files[i].FullName.Replace("\\", "/").Replace(filepath, ""), path+files[i].Name,true);
}
AssetDatabase.Refresh();
}
}
Unity 编辑器中Copy文件从一个文件夹到另一个文件夹
最新推荐文章于 2024-04-26 18:05:13 发布