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

后端 未结 7 947
误落风尘
误落风尘 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:44

    I had same problem in VB.NET and instead of "Directory.Move" I used MoveFolder with "FileSystemObject". You can preserve creation dates with this method.

    Scripting.FileSystemObject oFSO = new Scripting.FileSystemObject();
    oFSO.MoveFolder(sourceDirName, destDirName)
    

提交回复
热议问题