The best way to move a directory with all its contents(files or folders) in C#?

后端 未结 6 1889
萌比男神i
萌比男神i 2021-01-16 16:55

What is the best way to move directory with all its contents(files or folders) in C#?

I used the following codes, but it throws The Directory is not empty

6条回答
  •  孤城傲影
    2021-01-16 17:27

    You can try this

        DirectoryInfo dir = new DirectoryInfo(source);
        dir.MoveTo(newLocation);
    

提交回复
热议问题