C# merge one directory with another

前端 未结 2 640
[愿得一人]
[愿得一人] 2021-01-18 04:45

I have an autoupdater C# program. It will download a rar file that holds the changed or new files for the update to some software. The rar file has it\'s structure just like

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-18 05:29

    The simplest way is to use the FileSystem.MoveDirectory method. Make sure you add a reference to the Microsoft.VisualBasic.dll:

    using Microsoft.VisualBasic.FileIO;
    ...
    // Merge D:\SourceDir with D:\DestDir:
    FileSystem.MoveDirectory("D:\\SourceDir", "D:\\DestDir", true /* Overwrite */);
    

提交回复
热议问题