Search code examples
vb.netunzipoverwrite

Extracting and overwriting .zip files (.NET Framework 4.7.2.)


I have a program that needs to extract .zip files. (The program is written in .NET Framework 4.7.2.) In each .zip there are different folders and files. When the program extracts the .zip it needs to overwrite the old folders and files.

I am using: ZipFile.ExtractToDirectory(ExtractSource, ExtractDestination) The only problem is that I can't overwrite files with this. After searching for a long time, nothing has worked yet.

I would like to use: ZipFile.ExtractToDirectory(ExtractSource, ExtractDestination, true).
Where the "True" boolean in the code causes the files to be overwritten, but this code cannot be used in .NET Framework. Is there any code similar to this that I can use instead of mine?

I found most of the code Here.

Can anyone help me find a solution? Thanks!


Solution

  • I was able to extract and overwrite the files (in .NET Framework) using the library: ICSharpCode.SharpZipLib

    Installation: https://www.nuget.org/packages/SharpZipLib/1.3.2

    Useful code: https://github.com/icsharpcode/SharpZipLib/wiki/FastZip