c# 해당 폴더의 하위 폴더를 얻어오기 DirectoryInfo 클래스
참고 사이트 아래
http://holichouse.tistory.com/8
http://blog.naver.com/PostView.nhn?blogId=dwbhhstm&logNo=70083492702
private void getSubdirectory_Click(object sender, RoutedEventArgs e)
{
getDirectory(@"F:\");
}
void getDirectory(string path)
{
System.IO.DirectoryInfo Info = new System.IO.DirectoryInfo(path);
if (Info.Exists)
{
System.IO.DirectoryInfo[] CInfo = Info.GetDirectories("*",System.IO.SearchOption.AllDirectories);
foreach (System.IO.DirectoryInfo info in CInfo)
{
textBox1.Text += info.FullName + Environment.NewLine;
Console.WriteLine(info.FullName);
//getDirectory(info.FullName);
}
}
}
아예 GetDirectories()할 때 검색 옵션을 All로 주던가..아니면 걍 ()로 가져온 다음에
재귀함수로 돌리던가..하면 폴더 지정해주면 그 아래에 있는 모든 폴더를 가져올 수 있음...
이렇게 한다면...똑같이 복사한다던가 하는 방식으로
새경로 + 이전경로 - 드라이브경로 + 파일명 해서 파일복사라던가 배치도 돌릴 수 있겠다