static void VersionsDifferenceZipImp(string oldVersionDir, string newVersionDir) { oldVersionDir = MyFileUtil.DealFilePathSlash(oldVersionDir); newVersionDir = MyFileUtil.DealFilePathSlash(newVersionDir); List <string> oldFileList = new List <string>(); List <string> newFileList = new List <string>(); MyFileUtil.GetFileList(oldVersionDir, ref oldFileList); MyFileUtil.GetFileList(newVersionDir, ref newFileList); List <string> modificationFileList = new List <string>(); foreach (string newFilePath in newFileList) { int index = oldFileList.IndexOf(newFilePath); if (index < 0) { //添加新的文件 modificationFileList.Add(newFilePath); } else { string oldFilePath = oldFileList[index]; if (MD5Tool.VerifyFile(newFilePath, oldFilePath) == false) { //文件改变 modificationFileList.Add(newFilePath); } } } //string time = System.DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss"); string modificationDir = MyFileUtil.GetParentDir(newVersionDir) + "update_tmp"; MyFileUtil.DeleteDir(modificationDir); MyFileUtil.CreateDir(modificationDir); foreach (string filePath in modificationFileList) { string newFilePath = filePath.Replace(newVersionDir, modificationDir); MyFileUtil.CopyFile(filePath, newFilePath); } string zipFilePath = modificationDir + ".zip"; ZIPTool.CompressDirectory(modificationDir, zipFilePath, 0, false); Debug.Log(""); }