Apache Ant Tasks 简明教程

Apache Ant Tasks - GUnzip

Description

Gunzip 任务使用 GZip、BZip2 或 XZ 算法提取存档。仅当输出文件不存在或源资源较新时才会生成输出文件。如果省略 dest,则使用 src 的父目录。

Gunzip task extracts an archive using GZip, BZip2 or XZ algorithm. Output file is generated only if it is not present or source resource is newer. If dest is omitted, the parent dir of src is used.

Properties

Sr.No

Attributes & Description

1

src The file/collection to expand. (Mandatory)

2

Dest The destination file or directory. (Optional)

Example

Usage

使用以下内容创建 build.xml:

Create build.xml with the following content:

<?xml version="1.0"?>
   <project name="TutorialPoint" default="info">
   <target name="info">
      <gunzip src="text.gz" dest="text.txt"/>
      <echo>File extracted.</echo>
   </target>
</project>

Output

让我们将 text.gz 文件解压缩至 text.txt。现在在上面的构建文件中运行 Ant,将生成以下输出 −

Let’s extract the a text.gz file to text.txt. Now running Ant on the above build file produces the following output −

F:\tutorialspoint\ant>ant
Buildfile: F:\tutorialspoint\ant\build.xml

info:
   [gunzip] Expanding text.gz to F:\tutorialspoint\ant\text.txt
   [echo] File extracted.

BUILD SUCCESSFUL
Total time: 0 seconds

你可以验证已经创建了 text.txt 文件。

You can verify that the text.txt file is created.