Copying zip file issue...

Jun 14, 2008 at 9:28 AM
I am not sure if this is a DotNet Zip Library issue or not, but as I can copy other files fine, I think that it is.

I am attempting to copy a zip after creation and have found that I am unable to do this for some reason.  I tried "zip.Dispose()", but access to the file does not seem to be closed, and thus the file copy is failing.

Here is the code I am using to copy the file.

                    System.IO.BinaryReader Reader = new System.IO.BinaryReader(new System.IO.FileStream(tempFolder + @"\", System.IO.FileMode.Open), Encoding.ASCII);
                    System.IO.BinaryWriter Writer = new System.IO.BinaryWriter(new System.IO.FileStream(@"\\server\shared\test files\" + NameTB1.Text + ", " + NameTB2.Text + @"\", System.IO.FileMode.Create));
                    ProgressBar1.Maximum = (int)Reader.BaseStream.Length;

                    int nBytes = (int)Reader.BaseStream.Length;
                    ProgressBar1.Maximum = nBytes;
                    for (int i = 0; i < nBytes; i++)

Here is the code I am using to create the zip file:

            using (ZipFile zip = new ZipFile(FilePath + @"\"))
                string current = Directory.GetCurrentDirectory();


                BackgroundWorker worker = sender as BackgroundWorker;


                //Save the zip

I'm not sure wherin the problem lies, but I AM able to copy just about anything with the above code, so I think the zip file is remaining in use??  Maybe?

I'm open to any ideas or thoughts.  I am open to helping troubleshoot this as well.  I am using the most recent release of 1.5.

Thanks Again for a great utility.

Jun 14, 2008 at 7:25 PM
Edited Jun 14, 2008 at 7:33 PM

I have this problem with just-created files and my virus scanner.(Not limited to zip files - any large files at all)
Could that be happening to you?  
The virus scan engine keeps the file open until the scan is complete.
Then the file can be moved .  or copied.

ps: the Dispose() method is automatically called on the ZipFile if you use a using { ... } clause.   You don't need to call it explicitly .


Jun 27, 2008 at 11:12 AM
Thank you very much for the response (I apologize for the delay in responding back...).  I am unsure if that is the problem or not.  What would the recommended work around be?  Does this occur when saving a zip to a stream?

Thanks Again,