System.IO.DirectoryNotFoundException after deleting an empty folder and recreating it

后端 未结 7 2208
我在风中等你
我在风中等你 2021-02-13 04:37

I want to copy a folder, and i want to delete destination folder first. So I am deleting destination folder then recreate it and then copy files. The problem is that i get the <

7条回答
  •  走了就别回头了
    2021-02-13 04:56

    Why are you setting the file attributes after you have copied the file? Is this necessary?

    What you could do is first setting the the different attributes and afterwards doing the actual file copy. It also makes more sense, first checking if it is a ReadOnly file, and if it is, then set it to Normal, and do the copy.

提交回复
热议问题