public static OSFileInfoCollection GetFiles(string folderPath, BPMObjectNameCollection excludes) { DirectoryInfo folder = new DirectoryInfo(folderPath); FileInfo[] files = folder.GetFiles("*.*"); OSFileInfoCollection rv = new OSFileInfoCollection(); foreach (FileInfo fileInfo in files) { if ((fileInfo.Attributes & FileAttributes.Directory) == 0 && (fileInfo.Attributes & FileAttributes.System) == 0 && (fileInfo.Attributes & FileAttributes.Hidden) == 0) { if (NameCompare.Equals(fileInfo.Extension, ".extension")) { continue; } if (excludes.Contains(fileInfo.Extension)) { continue; } rv.Add(new OSFileInfo(fileInfo)); } } rv.Sort(); return(rv); }
public static void MoveFiles(string folderPath, BPMObjectNameCollection excludes, string[] filenames, string targetfilename, MovePosition position) { OSFileInfoCollection fileInfos = GetFiles(folderPath, excludes); fileInfos.Move <string>("Name", filenames, targetfilename, position); for (int i = 0; i < fileInfos.Count; i++) { OSFileInfo fileInfo = fileInfos[i]; fileInfo.OrderIndex = i; fileInfo.SaveExtensionInfo(); } }