GUnzip/BUnzip2

Description

Expands a file packed using GZip or BZip2.

If dest is a directory the name of the destination file is the same as src (with the ".gz" or ".bz2" extension removed if present). If dest is omitted, the parent dir of src is taken. The file is only expanded if the source file is newer than the destination file, or when the destination file does not exist.

Parameters

Attribute Description Required
src the file to expand. Yes
dest the destination file or directory. No

Examples

<gunzip src="test.tar.gz"/>

expands test.tar.gz to test.tar

<bunzip2 src="test.tar.bz2"/>

expands test.tar.bz2 to test.tar

<gunzip src="test.tar.gz" dest="test2.tar"/>

expands test.tar.gz to test2.tar

<gunzip src="test.tar.gz" dest="subdir"/>

expands test.tar.gz to subdir/test.tar (assuming subdir is a directory).

Related tasks

<gunzip src="some-archive.gz" dest="some-dest-dir"/>
is identical to
<copy todir="some-dest-dir">
  <gzipresource>
    <file file="some-archive.gz"/>
  </gzipresource>
  <mapper type="glob" from="*.gz" to="*"/>
</copy>

The same is also true for <bunzip2> and <bzip2resource>. <copy> offers additional features like filtering files on the fly, allowing a file to be mapped to multiple destinations, preserving the last modified time or a configurable file system timestamp granularity.


Copyright © 2000-2001,2004-2005 The Apache Software Foundation. All rights Reserved.