“Move will not work across volumes” - Why? And how to overcome?

后端 未结 7 950
误落风尘
误落风尘 2020-12-06 10:19

Why is it that File.Move(sourceFileName, destFileName) works fine when the source file and destination files are in different partitions, but Directory.Mo

7条回答
  •  既然无缘
    2020-12-06 10:52

    Another option is, to add a reference to the Microsoft.VisualBasic namespace and use the MoveDirectory method, which can move across volumes.

    Microsoft.VisualBasic.FileIO.FileSystem.MoveDirectory(sourceDirName, destDirName);
    

提交回复
热议问题