[
  {
    "Id": "570702",
    "ThreadId": "247192",
    "Html": "\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>If this directory is added : -</p>\r\n<p>e:\\Documents and Settings\\whatever.WHAT\\Desktop\\scan pages -9</p>\r\n<p>along with</p>\r\n<p>zip.MaxOutputSegmentSize = 1024*1024 ;</p>\r\n<p>Then I get this exception. if&nbsp;zip.MaxOutputSegmentSize = 1024*1024 ; is removed . then everything works. Similarly if the above mentioned directory is not added to the zipfile. the then things work. I have no idea why this happens.</p>\r\n<p>I am using the using clause.</p>\r\n<p>The exception :</p>\r\n<p>System.IO.FileNotFoundException was unhandled<br>\r\nMessage=&quot;Could not find file 'C:\\\\MyZipFile.z01'.&quot;<br>\r\nSource=&quot;mscorlib&quot;<br>\r\nFileName=&quot;C:\\\\MyZipFile.z01&quot;</p>\r\n<p><br>\r\nStackTrace:<br>\r\nat System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)<br>\r\nat System.IO.File.Move(String sourceFileName, String destFileName)<br>\r\nat Ionic.Zip.ZipSegmentedStream.TruncateBackward(UInt32 diskNumber, Int64 offset)</p>\r\n<p><br>\r\nat Ionic.Zip.ZipEntry.Write(Stream s)<br>\r\nat Ionic.Zip.ZipFile.Save()<br>\r\nat Ionic.Zip.ZipFile.Save(String fileName)<br>\r\nat WindowsFormsApplication1.Form1.backup_to_folder(String folderToSave) in E:\\My Downloads\\Visual Studio 2008\\Projects\\Backup\\Backup\\Backup-to-Gmail.cs:line 289<br>\r\nat WindowsFormsApplication1.Form1.run_zip_thread(String folderToSave, Object sender) in E:\\My Downloads\\Visual Studio 2008\\Projects\\Backup\\Backup\\Backup-to-Gmail.cs:line 161<br>\r\nat WindowsFormsApplication1.Form1.&lt;&gt;c__DisplayClass1.&lt;button3_Click&gt;b__0() in E:\\My Downloads\\Visual Studio 2008\\Projects\\Backup\\Backup\\Backup-to-Gmail.cs:line 152<br>\r\nat System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br>\r\nat System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br>\r\nat System.Threading.ThreadHelper.ThreadStart()<br>\r\nInnerException:</p>\r\n<p>&nbsp;</p>\r\n<p>My code:</p>\r\n<p>using (ZipFile zip = new ZipFile())<br>\r\n{<br>\r\n<br>\r\nzip.CompressionLevel = Ionic.Zlib.CompressionLevel.Level9;<br>\r\n<br>\r\nif (textBox2.Text != &quot;&quot;)<br>\r\n{<br>\r\n<br>\r\nzip.Encryption = EncryptionAlgorithm.WinZipAes256;<br>\r\nzip.Password = textBox2.Text;<br>\r\n}<br>\r\n<br>\r\nforeach (string s in addlist)<br>\r\n{<br>\r\n// add this map file into the &quot;images&quot; directory in the zip archive<br>\r\nif (File.Exists(s))<br>\r\n{<br>\r\n//try<br>\r\n{<br>\r\nConsole.WriteLine(&quot;adding file&quot;);<br>\r\nzip.AddFile(s);<br>\r\n<br>\r\n}<br>\r\n//// catch (ArgumentException ae)<br>\r\n//{<br>\r\n// Console.WriteLine(&quot;duplicate detected&quot;);<br>\r\n//}<br>\r\n// MessageBox.Show(&quot;addedfile&quot;);<br>\r\n}<br>\r\n<br>\r\nelse if (Directory.Exists(s))<br>\r\n{<br>\r\n<br>\r\nstring[] allfiles = Directory.GetFiles(s, &quot;*.*&quot;, SearchOption.AllDirectories);<br>\r\nstring[] alldirs = Directory.GetDirectories(s, &quot;*&quot;, SearchOption.AllDirectories);<br>\r\n<br>\r\n<br>\r\n<br>\r\n<br>\r\nforeach (string s2 in allfiles)<br>\r\n{<br>\r\ninclude = true ;<br>\r\nforeach (string ex in excludelist)<br>\r\n{<br>\r\nif (s2.Contains(ex) &amp;&amp; ex != &quot;&quot; )<br>\r\n{<br>\r\ninclude = false;<br>\r\n// Console.WriteLine(&quot;include=false. s2=&quot; &#43; s2 &#43; &quot;. ex=&quot; &#43; ex ) ; <br>\r\nbreak ;<br>\r\n}<br>\r\n}<br>\r\n<br>\r\nif ( include == true )<br>\r\n{<br>\r\n// try<br>\r\n{<br>\r\nzip.AddFile(s2);<br>\r\n}<br>\r\n// catch (ArgumentException ae)<br>\r\n{<br>\r\n<br>\r\n}<br>\r\n}<br>\r\n}<br>\r\n<br>\r\nforeach (string s3 in alldirs)<br>\r\n{<br>\r\ninclude = true;<br>\r\nforeach (string ex in excludelist)<br>\r\n{<br>\r\nif ( (s3.Contains(ex) &amp;&amp; ex != &quot;&quot;) || !dirempty(s3))<br>\r\n{<br>\r\ninclude = false;<br>\r\n// Console.WriteLine(&quot;include=false. s3=&quot; &#43; s3 &#43; &quot;. ex=&quot; &#43; ex); <br>\r\nbreak;<br>\r\n}<br>\r\n}<br>\r\n<br>\r\nif (include == true)<br>\r\n{<br>\r\n//try<br>\r\n{<br>\r\nzip.AddDirectory(s3, new DirectoryInfo(s3).FullName);<br>\r\n}<br>\r\n// catch (ArgumentException ae)<br>\r\n{<br>\r\n<br>\r\n}<br>\r\n}<br>\r\n}<br>\r\n<br>\r\n<br>\r\n}<br>\r\n<br>\r\nelse<br>\r\n{<br>\r\n// MessageBox.Show(&quot;error&quot;);<br>\r\n// path doesn't exist. <br>\r\n<br>\r\n}<br>\r\n}<br>\r\n<br>\r\n//try<br>\r\n{<br>\r\nzip.MaxOutputSegmentSize = 1024*1024 ;<br>\r\nzip.Save( folderToSave &#43; &quot;\\\\&quot; &#43; &quot;MyZipFile.zip&quot;);<br>\r\n<br>\r\n}<br>\r\n// catch (IOException ioe)<br>\r\n//{<br>\r\n// MessageBox.Show(&quot;Could not add one of the files/folders :( &quot; &#43; ioe.Data);<br>\r\n// }<br>\r\n//catch(FileNotFoundException de ) <br>\r\n//{<br>\r\n// Console.WriteLine(&quot;ignore&quot;) ;<br>\r\n// MessageBox.Show(&quot;Problem&quot;);<br>\r\n//}<br>\r\n<br>\r\npictureBox1.Image = null; <br>\r\nMessageBox.Show(&quot;zipped!&quot;);<br>\r\n}</p>\r\n<p>This forum is all broken in opera btw</p>\r\n",
    "PostedDate": "2011-02-23T03:47:34.07-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "571356",
    "ThreadId": "247192",
    "Html": "<p>I have narrowed down the problem. The problem is not with the directory, but with the following file: &nbsp;http://dillibuy.x10.bz/temp/scan%20pages.zip</p>\r\n<p>If this file is included along with &nbsp; zip.MaxOutputSegmentSize = 200 * 1024; .</p>\r\n<p>Then the following exception is thrown</p>\r\n<p style=\"padding-left: 30px;\">System.IO.FileNotFoundException was unhandled<br /> Message=\"Could not find file 'e:\\\\Documents and Settings\\\\whatever.WHAT\\\\Local Settings\\\\Temp\\\\uytxcabjv\\\\NoFrillsBackup 2011-02-24 14;46.z01'.\"</p>\r\n<p style=\"padding-left: 30px;\"><br /> Source=\"mscorlib\"<br /> FileName=\"e:\\\\Documents and Settings\\\\whatever.WHAT\\\\Local Settings\\\\Temp\\\\uytxcabjv\\\\NoFrillsBackup 2011-02-24 14;46.z01\"</p>\r\n<p style=\"padding-left: 30px;\"><br /> StackTrace:<br /> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)<br /> at System.IO.File.Move(String sourceFileName, String destFileName)<br /> at Ionic.Zip.ZipSegmentedStream.TruncateBackward(UInt32 diskNumber, Int64 offset)<br /> at Ionic.Zip.ZipEntry.Write(Stream s)<br /> at Ionic.Zip.ZipFile.Save()<br /> at Ionic.Zip.ZipFile.Save(String fileName)<br /> at WindowsFormsApplication1.Form1.backup_to_folder(String folderToSave, Object sender) in E:\\My Downloads\\Visual Studio 2008\\Projects\\Backup\\Backup\\Backup-to-Gmail.cs:line 351<br /> at WindowsFormsApplication1.Form1.run_zip_thread(String folderToSave, Object sender) in E:\\My Downloads\\Visual Studio 2008\\Projects\\Backup\\Backup\\Backup-to-Gmail.cs:line 186<br /> at WindowsFormsApplication1.Form1.&lt;&gt;c__DisplayClass4.&lt;button7_Click&gt;b__3() in E:\\My Downloads\\Visual Studio 2008\\Projects\\Backup\\Backup\\Backup-to-Gmail.cs:line 529<br /> at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br /> at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br /> at System.Threading.ThreadHelper.ThreadStart()<br />&nbsp;InnerException:</p>\r\n<p style=\"padding-left: 30px;\">&nbsp;</p>\r\n<p style=\"padding-left: 30px;\">Please help!</p>",
    "PostedDate": "2011-02-24T01:22:43.327-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]