IOException when saving split zip

Sep 18, 2010 at 6:48 PM

So after numerous tweaks to my own code for a simple backup program (find files, find most recent, zip the most recent), I figured that using a split zip would work best for me.  However, I can only get one save out of the split.  Every time after the first save, it'll start saving and when it tries to overwrite the first split file, it throws an IOException stating that it can't access that file because it's being used by another process.  I've made sure that my program is the only process using that file.  I suspect it's something to do with DotNetZip reading the file, thereby "using" it.  Is there something I can do to get around this, or is this something that maybe slipped by during development?

 

I'll post the code in a response to this, as when I try to post it in the initial post, it tends to get formatted badly. :\

Sep 18, 2010 at 6:53 PM

 

+ error {"The process cannot access the file 'E:\\UserBackup\\UserBackup.z01' because it is being used by another process."} System.IO.IOException

+ Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}

HelpLink null string+

InnerException null System.Exception

Message "The process cannot access the file 'E:\\UserBackup\\UserBackup.z01' because it is being used by another process." string

Source "mscorlib" string

StackTrace "   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n

at System.IO.File.Delete(String path)\r\n

at Ionic.Zip.ZipSegmentedStream._SetWriteStream(UInt32 increment) in C:\\DotNetZip\\v1.9.1.5\\DotNetZip\\Zip Partial DLL\\ZipSegmentedStream.cs:line 247\r\n

at Ionic.Zip.ZipSegmentedStream.Write(Byte[] buffer, Int32 offset, Int32 count) in C:\\DotNetZip\\v1.9.1.5\\DotNetZip\\Zip Partial DLL\\ZipSegmentedStream.cs:line 296\r\n

at Ionic.Zip.ZipEntry.CopyThroughWithNoChange(Stream outstream) in C:\\DotNetZip\\v1.9.1.5\\DotNetZip\\Zip Partial DLL\\ZipEntry.Write.cs:line 2284\r\n

at Ionic.Zip.ZipEntry.CopyThroughOneEntry(Stream outstream) in C:\\DotNetZip\\v1.9.1.5\\DotNetZip\\Zip Partial DLL\\ZipEntry.Write.cs:line 2119\r\n

at Ionic.Zip.ZipEntry.Write(Stream s) in C:\\DotNetZip\\v1.9.1.5\\DotNetZip\\Zip Partial DLL\\ZipEntry.Write.cs:line 1823\r\n

at Ionic.Zip.ZipFile.Save() in C:\\DotNetZip\\v1.9.1.5\\DotNetZip\\Zip Partial DLL\\ZipFile.Save.cs:line 124\r\n

at FileSafe.Form1.BackUp() in C:\\Users\\Cid the Coatrack\\Documents\\Visual Studio 2005\\Projects\\FileSafe\\FileSafe\\Form1.cs:line 419" string+

TargetSite {Void WinIOError(Int32, System.String)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}

 

Jan 20, 2011 at 12:57 AM

bump, anyone?  The project has pretty much stalled because I can't solve this problem. :(

Oct 24, 2013 at 12:37 PM
I still have the same error.

The problem seems to be related to an antivirus installed on the machine.

DotNetZip seems to close the stream after creating the .zxx file, leaving the opportunity to the antivirus to lock it, before DotNetZip tries to re open the stream.

Does anyone have a patch for this problem?