# <zip>

Creates a zip file from the specified filesets.

Uses #ziplib (SharpZipLib), an open source Tar/Zip/GZip library written entirely in C#.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
zipfile | file | The zip file to create. | True
comment | string | The comment for the file. | False
duplicate | DuplicateHandling | Specifies the behaviour when a duplicate file is found. The default is `Add`. | False
encoding | Encoding | The character encoding to use for filenames and comment inside the zip file. The default is the system's OEM code page. | False
includeemptydirs | bool | Include empty directories in the generated zip file. The default is false. | False
stampdatetime | datetime | Date/time stamp for the files in the format MM/DD/YYYY HH:MM:SS. | False
ziplevel | int | Desired level of compression. Possible values are 0 (STORE only) to 9 (highest). The default is `6`. | False
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False
unless | bool | Opposite of `if`. If false then the task will be executed; otherwise, skipped. The default is false. | False
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False

### Nested Elements:

#### <fileset>

The set of files to be included in the archive.

#### </fileset>

### Examples

- Zip all files in `${build.dir}` and `${doc.dir}` into a file called "backup.zip".

      <zip zipfile="backup.zip">
          <fileset basedir="${bin.dir}" prefix="bin">
              <include name="**/*" />
          </fileset>
          <fileset basedir="${doc.dir}" prefix="doc">
              <include name="**/*" />
          </fileset>
      </zip>

### Requirements

Assembly: NAnt.CompressionTasks (0.85.2478.0)