我想在C#中将目录的全部内容从一个位置复制到另一个位置.
似乎没有办法使用System.IO没有大量递归的类来完成此操作.
VB中有一个方法,如果我们添加一个引用,我们就可以使用它Microsoft.VisualBasic:
new Microsoft.VisualBasic.Devices.Computer().
FileSystem.CopyDirectory( sourceFolder, outputFolder );
Run Code Online (Sandbox Code Playgroud)
这似乎是一个相当丑陋的黑客.有没有更好的办法?