简体   繁体   English

如何复制目录?

[英]How do I copy a directory?

I want to copy one directory from one location to another but while copying I am getting an error message: 我想将一个目录从一个位置复制到另一个位置,但是在复制时出现错误消息:

" Could not complete operation on some files and directories. See the Data property of the exception for more details. " i don't know what is the problem Could not complete operation on some files and directories. See the Data property of the exception for more details. “我不知道是什么问题

I tried: 我试过了:

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

and

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

But I am still getting same message . 但是我仍然收到同样的信息。

Any pointers on how to get around this? 关于如何解决这个问题的任何指示?

Thanks. 谢谢。

You could try using 您可以尝试使用

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

If you're not sure of the flags or usage you can open a command prompt and type 如果不确定标志或用法,可以打开命令提示符并键入

xcopy /?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM