[
  {
    "Id": "527023",
    "ThreadId": "236054",
    "Html": "\r\n<p>Hi Guys</p>\r\n<p>Is it possible to rename the original file as it is being added to the zip archive..&nbsp; for example I have a batch of images which have to be zipped up into various zip files, but they need to be renamed based on the zip file it is being added to..&nbsp;\r\n So 1234.jpg being the original file name will be archived into test.zip but saved as 1234South.jpg..</p>\r\n<p>I am presently just copying the images to a folder and zipping up the contents per zip file needed, but the copying takes a very very long time (I have 200000 images being zipped every 4 hours or so), and I am sure I can do this more efficiently..&nbsp;\r\n I hope you can help..&nbsp; I am using VBScript to zip my files..</p>\r\n<p>&nbsp;</p>\r\n<p>Kind regards,</p>\r\n<p>&nbsp;</p>\r\n<p>Derek.</p>\r\n",
    "PostedDate": "2010-11-25T09:16:59.107-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "527056",
    "ThreadId": "236054",
    "Html": "\r\n<p>In a .NET language, you can do something like this:</p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">Using</span> zip <span style=\"color:blue\">As</span> <span style=\"color:blue\">New</span> ZipFile\r\n    zip.AddFile(<span style=\"color:#a31515\">&quot;1234.jpg&quot;</span>).FileName = <span style=\"color:#a31515\">&quot;1234South.jpg&quot;</span>\r\n    zip.Save(<span style=\"color:#a31515\">&quot;newzip.zip&quot;</span>)\r\n<span style=\"color:blue\">End</span> <span style=\"color:blue\">Using</span>\r\n\r\n\r\n</pre>\r\n</div>\r\n<p>The AddFile method returns a ZipEntry; you can then get or set properties on that ZipEntry.&nbsp; The above is equivalent to</p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">Using</span> zip <span style=\"color:blue\">As</span> <span style=\"color:blue\">New</span> ZipFile\r\n    <span style=\"color:blue\">Dim</span> entry <span style=\"color:blue\">as</span> ZipEntry = zip.AddFile(<span style=\"color:#a31515\">&quot;1234.jpg&quot;</span>)\r\n    entry.FileName = <span style=\"color:#a31515\">&quot;1234South.jpg&quot;</span>\r\n    zip.Save(<span style=\"color:#a31515\">&quot;newzip.zip&quot;</span>)\r\n<span style=\"color:blue\">End</span> <span style=\"color:blue\">Using</span></pre>\r\n</div>\r\n<p>The VBScript equivalent is like this....</p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">Dim</span> zip\r\n<span style=\"color:blue\">Dim</span> entry\r\n<span style=\"color:blue\">Set</span> zip = CreateObject(<span style=\"color:#a31515\">&quot;Ionic.Zip.ZipFile&quot;</span>)\r\n<span style=\"color:blue\">Set</span> entry = zip.AddFile (<span style=\"color:#a31515\">&quot;1234.jpg&quot;</span>)\r\nentry.FileName = <span style=\"color:#a31515\">&quot;1234South.jpg&quot;</span>\r\nzip.Name = <span style=\"color:#a31515\">&quot;newzip.zip&quot;</span>\r\nzip.Save\r\nzip.Dispose\r\n<span style=\"color:blue\">Set</span> entry = <span style=\"color:blue\">Nothing</span>\r\n<span style=\"color:blue\">Set</span> zip = <span style=\"color:blue\">Nothing</span>\r\n\r\n\r\n</pre>\r\n</div>\r\n",
    "PostedDate": "2010-11-25T10:40:36.913-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "527284",
    "ThreadId": "236054",
    "Html": "\r\n<p>Hi Cheeso</p>\r\n<p>&nbsp;</p>\r\n<p>The VBScript version worked well for me..&nbsp; Thank you and another cheeky question, in the same scenario but I already have an existing zip file, how can I add the file into it rather than create the zip..&nbsp;</p>\r\n<p>I'll leave you alone after that :)</p>\r\n<p>Many thanks</p>\r\n<p>&nbsp;</p>\r\n<p>Derek.</p>\r\n",
    "PostedDate": "2010-11-26T01:02:48.217-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "527318",
    "ThreadId": "236054",
    "Html": "\r\n<p>PS I am trying this code where newzip.zip exists already.&nbsp; When I run it I get an error saying it exists..&nbsp; If I delete the existing newzip.zip then it creates a new one with the file zipped up.</p>\r\n<p>Set Entry = zip.UpdateFile(&quot;c:\\certreq1.txt&quot;)<br>\r\nentry.FileName = &quot;C:\\archive1.txt&quot;&nbsp;&nbsp; <br>\r\nzip.Name = &quot;c:\\newzip.zip&quot;<br>\r\nzip.Save</p>\r\n<p>Thanks</p>\r\n<p>&nbsp;</p>\r\n<p>Derek.</p>\r\n",
    "PostedDate": "2010-11-26T03:46:23.69-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "527554",
    "ThreadId": "236054",
    "Html": "\r\n<p>you need to call zip.Initialize.&nbsp;</p>\r\n<p>like this:</p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">Dim</span> zip\r\n<span style=\"color:blue\">Set</span> zip = CreateObject(<span style=\"color:#a31515\">&quot;Ionic.Zip.ZipFile&quot;</span>)\r\nzip.Initialize filename\r\n\r\n</pre>\r\n</div>\r\n<p>At that point you can call UpdateFile.&nbsp;</p>\r\n<p>See <a href=\"http://cheeso.members.winisp.net/DotNetZipHelp/Code%20Examples/COM.htm\">\r\nthis page in the documentation</a> for more information.</p>\r\n",
    "PostedDate": "2010-11-26T17:05:06.483-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "527705",
    "ThreadId": "236054",
    "Html": "\r\n<p>Hi Cheeso</p>\r\n<p>That's what I missed..&nbsp; It works a treat for me..&nbsp;</p>\r\n<p>Many thanks,</p>\r\n<p>&nbsp;</p>\r\n<p>Derek.</p>\r\n",
    "PostedDate": "2010-11-27T10:34:28.287-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "529117",
    "ThreadId": "236054",
    "Html": "\r\n<p>Glad to hear it.</p>\r\n<p>Cheers.</p>\r\n<p>&nbsp;</p>\r\n",
    "PostedDate": "2010-11-30T15:47:56.757-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]