Answers for "how to finf file in folder in c#"

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

c# retrieve files in folder

string[] filePaths = Directory.GetFiles(@"c:MyDir", "*.bmp",
                                         SearchOption.AllDirectories);
// returns:
// "c:MyDirmy-car.BMP"
// "c:MyDirFriendsjames.BMP"
Posted by: Guest on June-16-2020

Code answers related to "how to finf file in folder in c#"

C# Answers by Framework

Browse Popular Code Answers by Language