Cannot create a file when that file already exists when using Directory.Move

后端 未结 5 920
我寻月下人不归
我寻月下人不归 2020-12-17 08:59

I am trying to move the directory from one location to another location on the same drive. I am getting \"Cannot create a file when that file already exists

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-17 09:47

    from http://msdn.microsoft.com/en-us/library/system.io.directory.move.aspx

    "This method throws an IOException if, for example, you try to move c:\mydir to c:\public, and c:\public already exists. You must specify "c:\public\mydir" as the destDirName parameter, provided that "mydir" does not exist under "c:\public", or specify a new directory name such as "c:\newdir"."

提交回复
热议问题