I see that the method System.IO.Compression.ZipFile.ExtractToDirectory(String, String, Boolean) is only available since .NET Core 2.0, not .NET Framework nor .NET Standard.
It will be available on .NET 5.
So on .NET Framework you need to delete files of an existing folder before extracting... or use another assembly from another developer:
using System.IO;
using System.IO.Compression;
if ( Directory.Exists(extractToPath) )
// Ask user confirmation if needed
Directory.Delete(extractToPath, true);
ZipFile.ExtractToDirectory(zipSourcePath, extractToPath);
System.IO.Directory.Delete()
Don't forget to add the reference in the project to the assembly System.IO.Compression.FileSystem
(see images below).
To only update the destination folder
With new files in the zip, you can extract the zip in a subfolder in the user temp folder, and next, move this folder to the folder where you have your tree to update.
It should do what you need.
string tempPath = System.IO.Path.GetTempPath();
ZipFile.ExtractToDirectory(zipSourcePath, tempPath);
And next use:
Directory.Move doesn't work (file already exist)
MoveDirectory(tempPath, extractToPath);
Because Directory.Move(string, string) Method can't be used since it does not allow overwriting..
Don't hesitate to open a new question if you have difficulty doing that.



