2013-10-05 4 views

답변

2

System.IO.Directory.GetFiles()를 사용하십시오. 광고 확장을 알고있는 경우 다음을 호출 할 수 있습니다.

Directory.GetFiles(@"C:\MergeMe\*.txt") 

다른 옵션이 필요한 경우 제공 할 수있는 과부하가 있습니다.

0
static void Main(string[] args) 
    { 
     foreach (string file in Directory.GetFiles("MyPath")) 
     { 
      if (Path.GetExtension(file)=="youExtension") 
      { 
       using (StreamReader sr = new StreamReader(file)) 
       { 
        //Your code 
       } 
      } 
     } 
    } 
관련 문제