Answers for "c# read folders in directory"

C#
3

read folder c#

string mydocpath=Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);     
      StringBuilder sb = new StringBuilder();
      foreach (string txtName in Directory.GetFiles(@"D:Links","*.txt"))
      {
        using (StreamReader sr = new StreamReader(txtName))
        {
          sb.AppendLine(txtName.ToString());
          sb.AppendLine("= = = = = =");
          sb.Append(sr.ReadToEnd());
          sb.AppendLine();
          sb.AppendLine();   
        }
      }
      using (StreamWriter outfile=new StreamWriter(mydocpath + @"AllTxtFiles.txt"))
      {    
        outfile.Write(sb.ToString());
      }
Posted by: Guest on November-06-2020
1

get folders in directory c#

string[] folders = System.IO.Directory.GetDirectories(@"C:My Sample Path","*", System.IO.SearchOption.AllDirectories);
Posted by: Guest on October-30-2020

Code answers related to "c# read folders in directory"

C# Answers by Framework

Browse Popular Code Answers by Language