I have an update solution for an application that uses the DotNetZip API ( link ) for handling ZIP files. One of the methods used is to overwrite files in certain folders as follows.
ZipFile zipFile = ZipFile.Read(file);
{
foreach (ZipEntry zipEntry in zipFile)
{
zipEntry.Extract(@"C:\IASD\CantinaEscolar", ExtractExistingFileAction.OverwriteSilently);
}
}
Where: @"c:\IASD\CantinaEscolar"
is the location where the files that are inside the zip (file)
will be unzipped.
If the directory already has a file with the same name as it will be unzipped, the application is returning an error for the file already in the directory.
System.IO.IOException: The file 'c:\IASD\CantinaEscola\nomedoarquivo.exe' already exists
.
Should this OverwriteSilently
method not overwrite the unzipped files silently (without user confirm request)?
Or, is there any way to force this override into the directory (of the -f type or something like that)?
If you have any other tips on how to do this, I'll be grateful.