1

I want to use ZipFile.ExtractToDirectory with a flag overwriteIfExisting, but unfortunately, there is no such parameter.

I saw the github issue on this dated back to 2016 where none of the suggested improvements actually have been made.

https://github.com/dotnet/runtime/issues/17150

...which is a long discussion, but without a resulting implementation.

Should I use ExtractToFile instead? Then I would need to handle recursion myself, right?

Or is there another zip library I should use instead?

Anders Lindén
  • 6,839
  • 11
  • 56
  • 109
  • Looks like that github issue was resolved with a new function overload from .NET Core 2.0 onwards https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.zipfile.extracttodirectory?view=net-6.0#system-io-compression-zipfile-extracttodirectory(system-string-system-string-system-boolean) – Charlieface Jul 28 '22 at 12:14

1 Answers1

2

The linked github issue was resolved with a new function overload for ExtractToDirectory, from .NET Core 2.0 onwards.

See the documentation.

public static void ExtractToDirectory (
    string sourceArchiveFileName,
    string destinationDirectoryName,
    Encoding? entryNameEncoding,
    bool overwriteFiles);
Charlieface
  • 52,284
  • 6
  • 19
  • 43