Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have one folder in C drive, whose name is saved according to today date. It has many sub folder inside. Each sub folder contains again folder and text files.Now i want to pickup folder inside C drive which is saved according to today date and check all subfolder inside that date folder and read all text files in it.
Can anyone please help me.
Posted

1 solution

C#
public void FindFiles(string startDir, string fileName)
       {


           if (Directory.Exists(startDir))
           {
             string[] files = Directory.GetFiles(startDir,      fileName,SearchOption.AllDirectories);

               if (files.Length > 0)
               {
                   foreach (string file in files)
                   {
                       resultsList.Items.Add(file);//Add to a Listview or whatever
                   }


               }
           }


       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900