Apache Ant Tasks - GUnzip
描述
Gunzip 任务使用 GZip、BZip2 或 XZ 算法提取档案。 仅当输出文件不存在或源资源较新时才会生成输出文件。 如果省略 dest,则使用 src 的父目录。
属性
| 序号 | 属性 & 描述 |
|---|---|
| 1 | src 要展开的文件/集合。 (强制的) |
| 2 | Dest 目标文件或目录。 (可选的) |
用法
示例
使用以下内容创建 build.xml:
<?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>
输出
让我们将一个 text.gz 文件提取到 text.txt。 现在在上述构建文件上运行 Ant 会产生以下输出 −
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 文件。

