【问题标题】:How do I copy a directory?如何复制目录?
【发布时间】:2014-05-12 01:43:28
【问题描述】:

我想将一个目录从一个位置复制到另一个位置,但是在复制时我收到一条错误消息:

"Could not complete operation on some files and directories. See the Data property of the exception for more details."不知道是什么问题

我试过了:

Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(FolderBrowserDialog1.SelectedPath, System.IO.Path.Combine(curDir, filename.Name))

My.Computer.FileSystem.CopyDirectory(FolderBrowserDialog1.SelectedPath, System.IO.Path.Combine(curDir, filename.Name))

但我仍然收到相同的消息。

关于如何解决这个问题的任何指示?

谢谢。

【问题讨论】:

  • 为什么要将文件名连接到 curDir 变量? CopyDirectory 的第二个参数应该是另一个文件夹

标签: vb.net copy directory move


【解决方案1】:

你可以试试

Process.StartInfo.Filename = "xcopy"
Process.StartInfo.Arguments = String.Format("{0} {1} {2}", sourcedir, destdir, xcopyflags)
Process.Start()

如果您不确定标志或用法,可以打开命令提示符并键入

xcopy /?

【讨论】:

    猜你喜欢
    • 2012-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-09
    • 2011-03-07
    • 2010-12-13
    • 2020-08-25
    • 1970-01-01
    相关资源
    最近更新 更多