C.91 ZipTask
Prev | Appendix C. Optional tasks | Next

## C.91 ZipTask

The `ZipTask` creates a .zip archive from a fileset or directory.

Table C.121: Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`destfile` | `String` | .ZIP filename | n/a | Yes
`basedir` | `String` | Base directory to zip (if no fileset specified, entire directory contents will be included in the archive) | none | No
`prefix` | `String` | File path prefix to use when adding files to zip | none | No
`includeemptydirs` | `Boolean` | If set to `true`, also empty directories are copied. | `true` | No
`comment` | `String` | Comment to add to the zip archive | none | No

Important note: using basedir and fileset simultaneously can result in strange contents in the archive.

### C.91.1 Example

    <zip destfile="phing.zip">
     <fileset dir=".">
         <include name="**/**" />
     </fileset>
    </zip>

The above example uses a fileset to determine which files to include in the archive.

    <zip destfile="phing.zip" basedir="."/>

The second example uses the basedir attribute to include the contents of that directory (including subdirectories) in the archive.

### C.91.2 Supported Nested Tags

- `fileset`

Prev | Up | Next
C.90 ZendGuardLicenseTask | Home | Appendix D. Core Types