如何复制txt/doc文件
我想将一个txt文件从一个文件夹复制到另一个文件夹。在应对时,我需要检查该文件是否存在,如果存在则替换该文件。
I want to copy a txt file from one folder to another. While coping i need to check whether the file exists or not, if yess then replace the file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
System.IO.File.Copy(source,destination, True)
来复制文件。第三个参数表示覆盖任何现有文件)。有关详细信息,请参阅此 MSDN 页面。
You can use
System.IO.File.Copy(source, destination, True)
to copy a file. The third parameter says to overwrite any existing file).See this MSDN page for details.