开发者

how to read and write files in a folder and subfolders

Merged with how to loop , read and write the folders and subfolders files.

I am having a problem in reading and writing the files in folders and subfolders .

can anyonesay me how can i give multiple path to find files in the subfolders.

For Example:- test is the main folder

1) C:\test\

and i want to read and write the subfolder files

2)C:\test\12-05-2011\12-05-2011.txt

3)C:\test\13-05-2011\13-05-2011.txt

4)C:\test\14-05-2011\14-05-2011.txt

my code is working for only 1 folder not for subfolders.

my code is .

   public void Timer1_Tick(System.Object sender, System.EventArgs e)
   { 

     string Path1 = "c:\\test" + "\\12-05-2011.txt");
     StreamReader reader1 = File.OpenText(Path1);
     string str = reader1.ReadToEnd();
     reader1.Close();
     reader1.Dispose();
     File.Delete(Path1);
     string[] Strarray = str开发者_运维技巧.Split(new char[] {Strings.ChrW(10)});
     int abc = Strarray.Length - 2;
    }

can anyone say me what i need to change in this code.

Thanks In Advance

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜