I need to calculate all directories and specific .tiff files (which are at the end of the structure). Sample is
A (selected path from UI) & lt; Is & gt; B & lt; & Gt; And C & LT; Is & gt; D & lt; Is & gt; E.F.G.H.J.L.L.L.; Is & gt; 1.tif 2.tif In the above directory, A has B and C which is enrolled as a client. B has D, E, F (dated), DKK and L (family). Please help you recover the directory structure in TSTT or
BDK 0 L2 (because there are two TIF files) EF Similiar C and For other directories.
It may be a trick (or at least a good start point): {File {SearchPattern}: Writite (GetStructure (New DirectoryInfo (folder)):
Public Zero Output StructureType (String OutputFilename, String Folder, String Search Pattern) {(var file = New Streamer (OutputFilename)) ); }} Public string GetStructure (directoryInfo directoryInfo, string search pattern) {GetStructureReserveive return (Directory Info, searchPattern, 0); } Private string GetStructureRecursive (directoryInfo directoryInfo, string search pattern, int level) {var sb = New StringBuilder (); Var indentation = level * 5; Sb.Append (new string ('', indentation)); Sb.AppendLine (directoryInfo.Name); Foreign Currency (Directory Info.GetDirectories () in Directory {sb.Append (GetStructureRecursive (Directory, Search Text, Level + 1)); } Has been grouped = Exchange = DirectoryInfoNet files (SearchPlan) .GroupBy (file => file.extension). Select (group = & gt; new {group = group.k, calculation = group.count ()}); Foreign exchange (individual entry in group entry) {sb.Append (new string ('', indentation)); Sb.AppendLine (String.Format ("{0,10} {1,3}", entry group, entry.count)); } Return sb.ToString (); } And if you want it as a .csv file for Excel, then you should use this recursive function instead
Personal String GetStructureRecursiveForCsv (directoryInfo directoryInfo, string searchPattern, int level) {var sb = new stringbilder (); Var indentation = level; Sb.Append (new string (';', indentation)); Sb.AppendLine (directoryInfo.Name); Foreach (Directory Directory- Info.GetDirectories ()) {sb.Append (GetStructureRecursiveForCsv (Directory, Search Text, Level + 1)); } Has been grouped = Exchange = DirectoryInfoNet files (SearchPlan) .GroupBy (file => file.extension). Select (group = & gt; new {group = group.k, calculation = group.count ()}); Foreign exchange (various entry in group entry) {sb.Append (new string (';', indentation)); Sb.AppendLine (String.Format ("; {0}; {1}", Entry Group, EntryCount)); } Return sb.ToString (); }
Comments
Post a Comment