'File.Copy' does not overwrite a file

后端 未结 7 1096
暗喜
暗喜 2020-11-30 11:08

Using the following code, I am trying to overwrite a file if it exists. Currenly it throws IOException. How can I fix this problem?

File.Copy(filePath, newPa         


        
7条回答
  •  死守一世寂寞
    2020-11-30 11:17

    This can help you:

    I use this and it works,

    File.Copy(src,des,true); //(string source, string destination, bool overwrite)
    

    Reference (MSDN): File.Copy Method (String, String, Boolean)

提交回复
热议问题