[
  {
    "Id": "256229",
    "ThreadId": "74860",
    "Html": "<p>I am trying to unzip password protected set of files in a folder , but i am getting &quot;Exception:Cannot Extract&quot;</p>\r\n<p>args[0]&nbsp; - folder give in command line argument , how exactly find what is the cause for this error message.</p>\r\n<p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>  <span style=\"color:Blue\">foreach</span> (FileInfo fle <span style=\"color:Blue\">in</span> File_List)\r\n            {\r\n                \r\n                <span style=\"color:Blue\">try</span>\r\n                {\r\n                    ZipFile zipfle = <span style=\"color:Blue\">new</span> ZipFile(fle.Name);\r\n                    \r\n                    <span style=\"color:Blue\">foreach</span> (ZipEntry e <span style=\"color:Blue\">in</span> zipfle)\r\n                    {\r\n                        e.ExtractWithPassword(args[0], <span style=\"color:#A31515\">&quot;password&quot;</span>);\r\n                     }\r\n                }\r\n                <span style=\"color:Blue\">catch</span> (ZipException ex)\r\n                {\r\n                    Console.WriteLine(<span style=\"color:#A31515\">&quot;Exception Occured:{0}\\n&quot;</span>, ex.Message);\r\n                }                \r\n            }\r\n</pre>\r\n</div>\r\n</p>",
    "PostedDate": "2009-11-12T00:24:55.613-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256234",
    "ThreadId": "74860",
    "Html": "<p>If you print out the exception, rather than just the message, you'll get some better insight.&nbsp; The exception you got wraps another exception, which provides more information as to the root cause of the problem.&nbsp; One of the most common problems is that the file to be extracted,&nbsp;already exists in the filesystem.&nbsp; If you want to overwrite an existing file you need to use an ovevrload of ExtractWithPassword that allows you to explicitly specify that.</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">foreach</span> (FileInfo fle <span style=\"color:Blue\">in</span> File_List)\r\n{\r\n    <span style=\"color:Blue\">try</span>\r\n    {\r\n        ZipFile zipfle = <span style=\"color:Blue\">new</span> ZipFile(fle.Name);\r\n\r\n        <span style=\"color:Blue\">foreach</span> (ZipEntry e <span style=\"color:Blue\">in</span> zipfle)\r\n        {\r\n            e.ExtractWithPassword(args[0], <span>ExtractExistingFileAction.OverwriteSilently, </span><span style=\"color:#A31515\">&quot;password&quot;</span>);\r\n        }\r\n    }\r\n    <span style=\"color:Blue\">catch</span> (ZipException ex)\r\n    {\r\n        Console.WriteLine(<span style=\"color:#A31515\">&quot;Exception Occured:{0}\\n&quot;</span>, ex.ToString());\r\n    }                \r\n}\r\n\r\n\r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-11-12T00:36:08.507-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256705",
    "ThreadId": "74860",
    "Html": "<p>&nbsp;</p>\r\n<div>\r\n<pre style=\"color:#000000;font-family:Consolas, 'Courier New', Courier, monospace;font-size:1em;margin:8px\"><span style=\"font-family:'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif\"><span style=\"white-space:normal\"><span style=\"font-family:Consolas, 'Courier New', Courier, monospace\"><span style=\"white-space:pre\"><div style=\"color:Black;background-color:White\"><pre>Changed the code</pre>\r\n<pre>Console.WriteLine(<span style=\"color:#A31515\">&quot;Exception Occured:{0}\\n&quot;</span>, ex.InnerException);\r\n</pre>\r\n</div>\r\n<br></span></span></span></span></pre>\r\n<pre style=\"color:#000000;font-family:Consolas, 'Courier New', Courier, monospace;font-size:1em;margin:8px\"><span style=\"font-family:'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif\"><span style=\"white-space:normal\"><span style=\"font-family:Consolas, 'Courier New', Courier, monospace\"><span style=\"white-space:pre\">Here is the Error</span></span></span></span></pre>\r\n<pre style=\"color:#000000;font-family:Consolas, 'Courier New', Courier, monospace;font-size:1em;margin:8px\"><span style=\"font-family:'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif\"><span style=\"white-space:normal\"><span style=\"font-family:Consolas, 'Courier New', Courier, monospace\"><span style=\"white-space:pre\"><p>Exception Occured:System.DllNotFoundException: Unable to load DLL 'coredll.dll':</p>\r\n<p>The specified module could not be found. (Exception from HRESULT: 0x8007007E)</p>\r\n<p>at Ionic.Zip.NetCfFile.CreateFileCE(String lpFileName, UInt32 dwDesiredAccess</p>\r\n<p>, UInt32 dwShareMode, Int32 lpSecurityAttributes, UInt32 dwCreationDisposition,</p>\r\n<p>UInt32 dwFlagsAndAttributes, Int32 hTemplateFile)</p>\r\n<p>at Ionic.Zip.NetCfFile.SetTimes(String filename, DateTime ctime, DateTime ati</p>\r\n<p>me, DateTime mtime)</p>\r\n<p>at Ionic.Zip.ZipEntry._SetTimes(String fileOrDirectory, Boolean isFile)</p>\r\n<p>at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, Strin</p>\r\n<p>g password)</p>\r\n<p>&nbsp;</p></span></span></span></span></pre>\r\n<pre style=\"color:#000000;font-family:Consolas, 'Courier New', Courier, monospace;font-size:1em;margin:8px\"><span style=\"font-family:'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif\"><span style=\"white-space:normal\"><span style=\"font-family:Consolas, 'Courier New', Courier, monospace\"><span style=\"white-space:pre\"><div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">Exception Occured:System.DllNotFoundException: Unable to load DLL 'coredll.dll':</div><div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">ecified module could not be found. (Exception from HRESULT: 0x8007007E)</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; at Ionic.Zip.NetCfFile.CreateFileCE(String lpFileName, UInt32 dwDesiredAccess</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">, UInt32 dwShareMode, Int32 lpSecurityAttributes, UInt32 dwCreationDisposition,</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">UInt32 dwFlagsAndAttributes, Int32 hTemplateFile)</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; at Ionic.Zip.NetCfFile.SetTimes(String filename, DateTime ctime, DateTime ati</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">me, DateTime mtime)</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; at Ionic.Zip.ZipEntry._SetTimes(String fileOrDirectory, Boolean isFile)</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, Strin</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">g password)</div>\r\n </span></span></span></span></pre>\r\n<pre style=\"color:#000000;font-family:Consolas, 'Courier New', Courier, monospace;font-size:1em;margin:8px\"><span style=\"font-family:'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif\"><span style=\"white-space:normal\"><span style=\"font-family:Consolas, 'Courier New', Courier, monospace\"><span style=\"white-space:pre\"><br></span></span></span></span></pre>\r\n</div>",
    "PostedDate": "2009-11-13T04:58:06.63-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256710",
    "ThreadId": "74860",
    "Html": "<p>I removed reference to&nbsp;</p>\r\n<p>Ionic.Zip.CF.dll&nbsp;</p>\r\n<p>then changed to&nbsp;</p>\r\n<p>Ionic.Zip.dll</p>\r\n<p>now i am able to unzip , but not all file still getting following error</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<div><span style=\"background-color:#ffffff\">Exception Occured:Ionic.Zip.ZipException: Cannot extract ---&gt; System.ArgumentExc</span></div>\r\n<div><span style=\"background-color:#ffffff\">eption: Illegal characters in path.</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[]</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;str)</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionA</span></div>\r\n<div><span style=\"background-color:#ffffff\">ccess access, AccessControlActions control, String[] pathListOrig, Boolean check</span></div>\r\n<div><span style=\"background-color:#ffffff\">ForDuplicates, Boolean needFullPath, Boolean copyPathList)</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess</span></div>\r\n<div><span style=\"background-color:#ffffff\">access, AccessControlActions control, String[] pathList, Boolean checkForDuplica</span></div>\r\n<div><span style=\"background-color:#ffffff\">tes, Boolean needFullPath)</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I</span></div>\r\n<div><span style=\"background-color:#ffffff\">nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o</span></div>\r\n<div><span style=\"background-color:#ffffff\">ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea</span></div>\r\n<div><span style=\"background-color:#ffffff\">n useLongPath)</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,</span></div>\r\n<div><span style=\"background-color:#ffffff\">FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean</span></div>\r\n<div><span style=\"background-color:#ffffff\">bFromProxy)</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; at System.IO.FileStream..ctor(String path, FileMode mode)</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, Strin</span></div>\r\n<div><span style=\"background-color:#ffffff\">g password)</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; --- End of inner exception stack trace ---</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, Strin</span></div>\r\n<div><span style=\"background-color:#ffffff\">g password)</span></div>\r\n<div><span style=\"background-color:#ffffff\">&nbsp;&nbsp; at chkziblib.Program.Main(String[] args) in d:\\code\\vcs10\\chkziblib\\chkziblib</span></div>\r\n<div><span style=\"background-color:#ffffff\">\\Program.cs:line 41</span></div>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-11-13T05:03:58.447-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256712",
    "ThreadId": "74860",
    "Html": "<p>Errors mainly with following file name&nbsp;</p>\r\n<p>test_exe.php_all=12312.zip</p>\r\n<p>&nbsp;</p>\r\n<p>?!</p>",
    "PostedDate": "2009-11-13T05:06:54.313-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256716",
    "ThreadId": "74860",
    "Html": "<p>First, Ionic.Zip.CF.dll should be used for .NET Compact Framework applications.&nbsp; Ionic.Zip.dll should be used for applications that use the regular .NET Framework.</p>\r\n<p>Second - the exception I See is <strong>&quot;<span style=\"background-color:#ffffff\">Illegal characters in path.&quot;</span></strong></p>\r\n<p><span style=\"background-color:#ffffff\">Do you see that?&nbsp; I believe the = is not a legal character for a pathname. </span></p>\r\n<p><strong><span style=\"background-color:#ffffff\">&nbsp;</span></strong></p>",
    "PostedDate": "2009-11-13T05:12:24.973-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256745",
    "ThreadId": "74860",
    "Html": "<p>as you said &quot;test_exe.php_all=12312.zip&quot; &nbsp;has invalid &quot;=&quot; sign , but tested against winrar that gives error and still able to uncompress the file.</p>",
    "PostedDate": "2009-11-13T06:23:18.983-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256793",
    "ThreadId": "74860",
    "Html": "<p>&gt; tested against winrar that gives error and still able to uncompress the file.</p>\r\n<p>Are you saying that WinRar was able to read and uncompress the file?</p>\r\n<p>If so, that's interesting.&nbsp; What is the name of the resulting extracted file in the filesystem?</p>\r\n<p>---</p>\r\n<p>If you don't mind changing the name, you can rename the entry prior to extraction. &nbsp;&nbsp;ZipEntry.FileName is a read/write property.&nbsp;&nbsp; Set it prior to calling ExtractWithPassword, and DotNetZip will use the new name to create the file.</p>\r\n<p>Another alternative is to call ZipEntry.OpenReader() and&nbsp; extract the contents into a file with a name of your choice.</p>\r\n<p>Good luck!</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-11-13T07:54:27.387-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256902",
    "ThreadId": "74860",
    "Html": "<p>Cheeso , thanks for wonderful help.</p>\r\n<p>&nbsp;</p>\r\n<p>winrar &nbsp;creates a folder with following name &quot;test_exe.php_all=12312&quot; , while it does give error during uncompression. But with 7Zip no Error message &amp; unzips fine.</p>\r\n<p>&nbsp;</p>\r\n<p>I would try to use the ZipEntry.FileName , but i am got 1k files to uncompress.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-11-13T11:38:06.653-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256904",
    "ThreadId": "74860",
    "Html": "<p>1k files is not that many?&nbsp; anyway it is a 2 line check inside the extraction loop.&nbsp; Like this:</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">foreach</span> (FileInfo fle <span style=\"color:Blue\">in</span> File_List)\r\n{\r\n    <span style=\"color:Blue\">try</span>\r\n    {\r\n        ZipFile zipfle = <span style=\"color:Blue\">new</span> ZipFile(fle.Name);\r\n\r\n        <span style=\"color:Blue\">foreach</span> (ZipEntry e <span style=\"color:Blue\">in</span> zipfle)\r\n        {\r\n            <span style=\"color:Green\">// check for illegal characters</span>\r\n            <span style=\"color:Blue\">if</span> (e.FileName.Contains(<span style=\"color:#A31515\">&quot;=&quot;</span>)) \r\n                e.FileName = e.FileName.Replace(<span style=\"color:#A31515\">&quot;=&quot;</span>,<span style=\"color:#A31515\">&quot;--&quot;</span>);\r\n            e.ExtractWithPassword(args[0], ExtractExistingFileAction.OverwriteSilently, <span style=\"color:#A31515\">&quot;password&quot;</span>);\r\n        }\r\n    }\r\n    <span style=\"color:Blue\">catch</span> (ZipException ex)\r\n    {\r\n        Console.WriteLine(<span style=\"color:#A31515\">&quot;Exception Occured:{0}\\n&quot;</span>, ex.ToString());\r\n    }                \r\n}\r\n\r\n\r\n</pre>\r\n</div>",
    "PostedDate": "2009-11-13T11:42:58.283-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256907",
    "ThreadId": "74860",
    "Html": "<p>code worked fine &amp; my issue solved , thanks again Cheeso , i just started using dotnetzip &amp; its wonderful contribution.</p>",
    "PostedDate": "2009-11-13T11:49:29.343-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]