Unity 文件复制工具
来源:互联网 发布:数据删除恢复软件 编辑:程序博客网 时间:2024/06/05 10:56
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
public class Builder {
[MenuItem("Builder/CopyToServer")]
public static void CopyToServer()
{
string folder = Application.streamingAssetsPath;
DirectoryInfo streamingAsset = new DirectoryInfo(folder);
GetDirectory(streamingAsset);
}
public static string serverPath = @"D:\www\StreamingAssets";
public static void GetDirectory(DirectoryInfo direc)
{
string localFolderName = direc.FullName;
string localFolder = localFolderName.Substring(localFolderName.LastIndexOf("StreamingAssets"));
localFolder = localFolder.Replace("StreamingAssets", "");
localFolder = serverPath + "/" + localFolder;
if (!Directory.Exists(localFolder))
Directory.CreateDirectory(localFolder);
FileInfo[] fileInfos = direc.GetFiles();
for (int i = 0; i < fileInfos.Length; i++)
{
string fileFullName = localFolder + "/" + fileInfos[i].Name;
FileInfo file = new FileInfo(localFolder+"/"+fileInfos[i].Name);
if (file.Exists) file.Delete();
fileInfos[i].CopyTo(fileFullName);
Debug.Log(fileFullName);
}
DirectoryInfo[] folders = direc.GetDirectories();
foreach(DirectoryInfo info in folders)
{
GetDirectory(info);
}
}
}
using System.Collections;
using UnityEditor;
using System.IO;
public class Builder {
[MenuItem("Builder/CopyToServer")]
public static void CopyToServer()
{
string folder = Application.streamingAssetsPath;
DirectoryInfo streamingAsset = new DirectoryInfo(folder);
GetDirectory(streamingAsset);
}
public static string serverPath = @"D:\www\StreamingAssets";
public static void GetDirectory(DirectoryInfo direc)
{
string localFolderName = direc.FullName;
string localFolder = localFolderName.Substring(localFolderName.LastIndexOf("StreamingAssets"));
localFolder = localFolder.Replace("StreamingAssets", "");
localFolder = serverPath + "/" + localFolder;
if (!Directory.Exists(localFolder))
Directory.CreateDirectory(localFolder);
FileInfo[] fileInfos = direc.GetFiles();
for (int i = 0; i < fileInfos.Length; i++)
{
string fileFullName = localFolder + "/" + fileInfos[i].Name;
FileInfo file = new FileInfo(localFolder+"/"+fileInfos[i].Name);
if (file.Exists) file.Delete();
fileInfos[i].CopyTo(fileFullName);
Debug.Log(fileFullName);
}
DirectoryInfo[] folders = direc.GetDirectories();
foreach(DirectoryInfo info in folders)
{
GetDirectory(info);
}
}
}
0 0
- Unity 文件复制工具
- 文件复制工具dd
- java 文件复制 文件夹复制工具类
- java复制文件工具类
- Java复制文件工具类
- 源码文件复制工具 for ACMer
- MFC根据前缀批量复制文件工具
- 文件生成或复制的工具类
- unity工具
- Windows下快速复制文件工具Robocopy介绍
- native转ascii工具(复制成html文件即可用)
- windows与linux复制文件(类似于linux的scp工具)
- Windows文件检索、复制工具(Python Tkinter)
- 文件复制,移动,删除,压缩等多功能工具类FileUtil
- Java中实现复制文件到文件,复制文件到文件夹,复制文件夹到文件,删除文件,删除文件夹,移动文件,移动文件夹的工具类
- unity 在菜单中添加 复制文件菜单项(简易版)
- JAVA文件工具类之——文件复制、内容获取、目录获取、文件转换
- 正则判断是不是手机号码&复制文件工具类&SharedPreferencesUtils工具类
- hibernate映射不到实体的坑
- duplicate报错:ORA-12154
- Ubuntu 删除缓存(转载)
- AndroidUI学习篇之Fragment
- 早研
- Unity 文件复制工具
- S5PV210开发系列五 sd卡驱动实现
- C++嵌入lua脚本
- thinkphp引入 阿里大于短信平台
- Cygwin下vim配置
- banner轮播图
- 所有元素遍历
- html的空格显示距离问题
- 算法导论学习笔记-2