I have a solution for updating an application that uses the API DotNetZip (http://dotnetzip.codeplex.com/) for handling ZIP files. One method 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: \ SDA \ CantinaEscolar"
is where are unzipped the files inside the zip (files)
.
Now, if the directory already contains a file with the same name that will be unpacked, the application is returning an error related to the file already exists in the directory.
System.IO.IOException:The file 'c:\IASD\CantinaEscola\nomedoarquivo.exe' already exists
OverwriteSilently
This
method should not override the unzipped files silently (without requesting user confirmation)?
Or: Is there any way to force this overwritten within the directory (-type f or something)?
If you possess any other tips on how to accomplish this task, I will be grateful.