[英]Merging folders or subfolders with same name using C#
I have two folders at different locations but with the same name.我有两个位于不同位置但名称相同的文件夹。 A file is generated in one of the folders and it is to be copied to the other folder but without overwriting the existing contents in C#.
在其中一个文件夹中生成一个文件,并将其复制到另一个文件夹,但不会覆盖 C# 中的现有内容。
File.Copy
overwrites the contents which makes me lose the previous contents. File.Copy
覆盖了使我丢失以前的内容的内容。 Is it possible to merge the contents in the folder?是否可以合并文件夹中的内容?
Use the overloaded version of File.Copy
:使用
File.Copy
的重载版本:
File.Copy(sourcefile,destfile,false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.