0

here is my code...

string file = Environment.CurrentDirectory+"\\Downloads\\zipfile.zip";
string unpackDirectory = Path.GetDirectoryName(Environment.CurrentDirectory);
var zip = new Ionic.Zip.ZipFile();
zip = Ionic.Zip.ZipFile.Read(file);
zip.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
zip.ExtractAll(unpackDirectory);

when it runs it creates a file with an extension .PendingOverwrite then outputs in the console that access to that file is denied.

I think maybe the code is running twice back to back but not entirely sure. any help would be appreciated.

  • Environment.CurrentDirectory is already the string representing the current directory. GetParentDirectory will jump one level from the current. Are you sure that you have permissions to write in that folder? – Steve Nov 18 '19 at 18:46
  • the code is working. its replacing the file in the directory with the file in the zip but its created that .PendingOverwrite file and erroring saying it doesnt have permission to access that file – Paul Cooley Nov 18 '19 at 18:54
  • Any updates on this because I'm facing the same issue. For me, I am trying to execute sql scripts inside a just unzipped folder (using dotnetzip). However, it also creates that PendingOverwrite file and says it doesnt have permission for that file. And, my sql scripts are not executed. – Ryan Jul 14 '20 at 04:54

0 Answers0