# C1.Zip.C1ZipFile.OpenBatch

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Zip_C1ZipFile_OpenBatch_" data-uid="C1.Zip.C1ZipFile.OpenBatch*">OpenBatch Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Zip_C1ZipFile_OpenBatch_" data-uid="C1.Zip.C1ZipFile.OpenBatch*"></a>
<h4 id="C1_Zip_C1ZipFile_OpenBatch" data-uid="C1.Zip.C1ZipFile.OpenBatch">OpenBatch()</h4>
<div class="markdown level1 summary"><p>Opens the zip file for multiple operations.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void OpenBatch()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub OpenBatch()</code></pre>
</div>
<h5 id="C1_Zip_C1ZipFile_OpenBatch_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>By default, <a class="xref" href="C1.Zip.C1ZipFile.html">C1ZipFile</a> opens and closes the zip file 
automatically whenever entries are added or removed.</p>
<p>This can cause delays in systems that have certain types of anti-virus
software installed, or in situations where you want to add a large number of 
relatively small entries. In these cases, use the <a class="xref" href="C1.Zip.C1ZipFile.OpenBatch.html#C1_Zip_C1ZipFile_OpenBatch">OpenBatch()</a> and 
<a class="xref" href="C1.Zip.C1ZipFile.CloseBatch.html#C1_Zip_C1ZipFile_CloseBatch">CloseBatch()</a> methods to keep the zip file open until the entire 
operation is concluded.</p>
<p>Use a finally clause to ensure that the <a class="xref" href="C1.Zip.C1ZipFile.CloseBatch.html#C1_Zip_C1ZipFile_CloseBatch">CloseBatch()</a> 
method is called even if an exception occurs.</p>
</div>
<h5 id="C1_Zip_C1ZipFile_OpenBatch_examples">Examples</h5>
<p>The code below opens a zip file, adds several entries to it, then closes
the file:</p>
<pre><code class="lang-csharp">C1ZipFile zip = new C1ZipFile();
zip.Open(myzipfile);
try
{
	zip.OpenBatch();
	foreach (string fileName in Directory.GetFiles(path, "*.*"))
		zip.Entries.Add(fileName);
}
finally
{
	zip.CloseBatch();
}</code></pre>

</div>
