【问题标题】:Transfer files in using c#使用 c# 传输文件
【发布时间】:2010-05-23 10:28:38
【问题描述】:

如何使用 c# 将文件从文件夹复制到另一个文件夹?

【问题讨论】:

    标签: c# file copy


    【解决方案1】:

    这是来自 MSDN 的一个很好的例子:

    How to: Copy, Delete, and Move Files and Folders (C# Programming Guide)

    【讨论】:

    • +1 为了让提问者学习的最佳方式 - 另外,欢迎来到 SO:)
    【解决方案2】:

    上面建议的 System.IO.File、System.IO.Directory、System.IO.FileInfo 类“Mr.Expert”适用于复制和删除单个文件。

    但是,如果您要删除/复制大量文件,则最好使用替代方法,请参阅我之前提出的这个问题..

    Delete a large number (>100K) of files with c# whilst maintaining performance in a web application?

    System.IO.Directory.GetFiles 在处理大量文件时可能会导致性能问题。

    【讨论】:

      【解决方案3】:
      System.IO.File.Copy
      

      【讨论】: