간단한 문제로 C# 전문가의 도움을받을 수 있습니다. 몇 가지 이상한 이유로 나는 해결할 수 없습니다. 나는 새로운 디렉토리를 현재 디렉토리에 여러 하위 폴더를 이동하고 하위 폴더 이름을 유지하기 위해 노력하고있어, 아래 참조 : 순간여러 하위 폴더를 다른 디렉터리로 이동하고 폴더 이름을 유지하십시오.
public string currentDirectory = System.Environment.GetEnvironmentVariable("LOCALAPPDATA") + @"\Test\CurrentFolder\";
public string newDirectory = System.Environment.GetEnvironmentVariable("LOCALAPPDATA") + @"\Test\NewFolder\";
private void btnMoveFolder_Click(object sender, RoutedEventArgs e)
{
string[] subdirectoryEntries = Directory.GetDirectories(currentDirectory);
try
{
foreach (string subCurrentDirectory in subdirectoryEntries)
{
Directory.Move(subCurrentDirectory, newDirectory);
}
}
catch (System.Exception)
{
Log("Problem with moving the directory.");
}
}
를, 나는 단지 모든 대신 하나 개의 폴더를 이동 할 수있을 것 그들 중.
도움이 될 것입니다.
sooo ... 사용중인 코드가 _problem_ 인 이유는 무엇입니까 (서식 지정은 따로하고 :))? – sehe