public static void ListFiles(FileSystemInfo fileSysInfo) { MFileInfo info = new MFileInfo(); info.FullName = fileSysInfo.FullName; info.FileName = fileSysInfo.Name; if (IsIgnore(info.FullName)) { return; } else if (System.IO.Directory.Exists(info.FullName)) { info.IsFolder = true; } else if (System.IO.File.Exists(info.FullName)) { info.IsFolder = false; } else { return; } if (info.IsFolder) { #region 偵測資料夾 //info.UniqueCode = getFileUniqueCode(info.FullName + fileSysInfo.CreationTime); //info.LastUpdateTime = fileSysInfo.LastWriteTime; //listFileInfo.Add(info); #endregion DirectoryInfo dirInfo = new DirectoryInfo(info.FullName); foreach (FileSystemInfo item in dirInfo.GetFileSystemInfos()) { ListFiles(item); } } else { //Console.WriteLine(info.FullName + "\t" + fileSysInfo); info.LastUpdateTime = fileSysInfo.LastWriteTime; info.UniqueCode = getFileUniqueCode(info.FullName); //info.show(); listFileInfo.Add(info); } }
public void record(MFileInfo data) { pFile.WriteLine(string.Format("{0},{1}", data.FullName, data.UniqueCode)); }