// DirectoryInfo di = new DirectoryInfo(@"D:Test"); // FindFile(di); static void FindFile(DirectoryInfo di) { FileInfo[] fis = di.GetFiles(); for (int i = 0; i < fis.Length; i++) { Console.WriteLine("文件:" + fis[i].FullName); } DirectoryInfo[] dis = di.GetDirectories(); for (int j = 0; j < dis.Length; j++) { Console.WriteLine("目录:" + dis[j].FullName); FindFile(dis[j]); } }
根据父级遍历全部数据
BaseOrganizeManager organizeManager = new BaseOrganizeManager(); int count = 0; JsonResult<string> reult = null; void FindChild(List<BaseOrganizeEntity> organizeEntities) { foreach (var item in organizeEntities) { if (item.Enabled == 0 || item.DeletionStateCode == 1) { continue; } reult = CaiNiaoAPIUtilities.SyncOrganizeToCaiNiao(item); System.Console.WriteLine(count + ",执行同步:" + item.FullName + "," + DateTime.Now); System.Console.WriteLine("返回" + reult.Data + "," + DateTime.Now); count++; } List<BaseOrganizeEntity> organizeChids = null; string where = string.Empty; foreach (var item in organizeEntities) { where = BaseOrganizeEntity.FieldParentId + " = '" + item.Id + "' "; organizeChids = organizeManager.GetList<BaseOrganizeEntity>(where); FindChild(organizeChids); } }
string where = BaseOrganizeEntity.FieldParentId + " IS NULL "; List<BaseOrganizeEntity> organizeEntities = organizeManager.GetList<BaseOrganizeEntity>(where); FindChild(organizeEntities);