<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[GMan's Mods & Stuff — zwObject.RemoveFile()?]]></title>
	<link rel="self" href="https://gprogs.com/extern.php?action=feed&amp;tid=467&amp;type=atom" />
	<updated>2012-08-23T11:15:55Z</updated>
	<generator>PunBB</generator>
	<id>https://gprogs.com/viewtopic.php?id=467</id>
		<entry>
			<title type="html"><![CDATA[Re: zwObject.RemoveFile()?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1740#p1740" />
			<content type="html"><![CDATA[<p>thanks for the sample code!&nbsp; i will take a stab at this tonight and see what i come up with.</p>]]></content>
			<author>
				<name><![CDATA[gman]]></name>
				<uri>https://gprogs.com/profile.php?id=2</uri>
			</author>
			<updated>2012-08-23T11:15:55Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1740#p1740</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zwObject.RemoveFile()?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1739#p1739" />
			<content type="html"><![CDATA[<p>I was hoping to avoid the recreation of a zip. But one can&#039;t have everything.</p><p>In the meantime I coded a basic function. The only little issue is that the tempory files aren&#039;t deleted from the HDD. Probably because there are still in use.</p><p>It might be best to do this stuff all in memory. With modern PCs this shouldn&#039;t be a problem (when you only store one file at a time). The process should be a lot faster than the HDD method.</p><div class="codebox"><pre><code>Function Delete_File_from_Zip(InFile:String, OutFile:String, DelFile:String)

    Local zwObject:ZipWriter = New ZipWriter
    Local zrObject:ZipReader = New ZipReader
 
    If ( zrObject.OpenZip( InFile ) ) Then

    If ( zwObject.OpenZip( OutFile, False) ) Then
    
        Local ZipFileCount: Int = zrObject.getFileCount()
          
              Print &quot;&quot;
        Print &quot;Working! &#039;&quot;+OutFile+&quot;&#039; - filecount: &quot;+ZipFileCount
              Print &quot;&quot;
         
        For Local i:Int=0 To ZipFileCount-1
        
        Local FileName:String=zrObject.getFileInfo(i).simpleFileName
        
        If FileName &lt;&gt; DelFile Then
             
             zrObject.ExtractFileToDisk( FileName, FileName )
                zwObject.AddFile(FileName)
        
              DeleteFile( FileName )        
         &#039;        Print FileName + &quot; copied...&quot;
        &#039;Else
         &#039;        Print FileName + &quot; skipped...&quot; 
        EndIf 

        Next 
        zwObject.CloseZip()
    EndIf

        zrObject.CloseZip()
    End If
    
End Function</code></pre></div><p>If I&#039;m the only user that does such file manipulations, it&#039;s not worth the time and effort.</p>]]></content>
			<author>
				<name><![CDATA[Grisu]]></name>
				<uri>https://gprogs.com/profile.php?id=264</uri>
			</author>
			<updated>2012-08-23T10:54:47Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1739#p1739</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zwObject.RemoveFile()?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1738#p1738" />
			<content type="html"><![CDATA[<p>greetings Grisu i hope all is well <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; unfortunately the base library does not provide a delete file functionality.&nbsp; the best i can do is create a new temp zip file and extract/rezip all the files not to be deleted into it.&nbsp; it would be a convenience function but depending on the size of the zip it could take a while.&nbsp; i could do the work in memory but again, depending on the machine&#039;s memory and the size of the zip i could fill that quick.&nbsp; maybe make it optional?&nbsp; would something like that work for you or were you working to avoid the recreation?</p>]]></content>
			<author>
				<name><![CDATA[gman]]></name>
				<uri>https://gprogs.com/profile.php?id=2</uri>
			</author>
			<updated>2012-08-21T23:05:04Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1738#p1738</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[zwObject.RemoveFile()?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1737#p1737" />
			<content type="html"><![CDATA[<p>Hi!</p><p>What&#039;s the best way to remove a certain file from multiple zip files (1000+) without having to recreate them manually each time?</p><p>A command like &quot;zwObject.RemoveFile(filename)&quot; would be quite helpful here.</p><p>Grisu</p>]]></content>
			<author>
				<name><![CDATA[Grisu]]></name>
				<uri>https://gprogs.com/profile.php?id=264</uri>
			</author>
			<updated>2012-08-19T09:13:14Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1737#p1737</id>
		</entry>
</feed>
