<p>I'm using the following code, using the <a href="http://www.sharpziplib.com/" rel="noreferrer">SharpZipLib</a> library, to add files to a .zip file, but each file is being stored with its full path.  I need to only store the file, in the 'root' of the .zip file.</p>

<pre><code>string[] files = Directory.GetFiles(folderPath);
using (ZipFile zipFile = ZipFile.Create(zipFilePath))
{
     zipFile.BeginUpdate();
     foreach (string file in files)
     {
          zipFile.Add(file);
     }
     zipFile.CommitUpdate();
}
</code></pre>

<p>I can't find anything about an option for this in the supplied documentation.  As this is a very popular library, I hope someone reading this may know something.</p>

How about using
System.IO.Path.GetFileName()
combined with the entryName parameter of ZipFile.Add()?
```
```
string[] files = Directory.GetFiles(folderPath);
using (ZipFile zipFile = ZipFile.Create(zipFilePath))
{
     zipFile.BeginUpdate();
     foreach (string file in files)
     {
          zipFile.Add(file, System.IO.Path.GetFileName(file));
     }
     zipFile.CommitUpdate();
}
```
```