You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

unzip.html 4.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Unzip Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="unzip">Unjar/Untar/Unwar/Unzip</a></h2>
  8. <h3>Description</h3>
  9. <p>Unzips a zip-, war-, tar- or jarfile.</p>
  10. <p>For JDK 1.1 &quot;last modified time&quot; field is set to current time instead of being
  11. carried from the archive file.</p>
  12. <p><a href="../CoreTypes/patternset.html">PatternSet</a>s are used to select files to extract
  13. <I>from</I> the archive. If no patternset is used, all files are extracted.
  14. </p>
  15. <p><a href="../CoreTypes/fileset.html">FileSet</a>s may be used to select archived files
  16. to perform unarchival upon.
  17. </p>
  18. <p>You can define filename transformations by using a nested <a href="../CoreTypes/mapper.html">mapper</a> element. The default mapper is the
  19. <a href="../CoreTypes/mapper.html#identity-mapper">identity mapper</a>.
  20. </p>
  21. <p>File permissions will not be restored on extracted files.</p>
  22. <p>The untar task recognizes the long pathname entries used by GNU tar.<p>
  23. <h3>Parameters</h3>
  24. <table border="1" cellpadding="2" cellspacing="0">
  25. <tr>
  26. <td valign="top"><b>Attribute</b></td>
  27. <td valign="top"><b>Description</b></td>
  28. <td align="center" valign="top"><b>Required</b></td>
  29. </tr>
  30. <tr>
  31. <td valign="top">src</td>
  32. <td valign="top">archive file to expand.</td>
  33. <td align="center" valign="top">Yes, if filesets are not used.</td>
  34. </tr>
  35. <tr>
  36. <td valign="top">dest</td>
  37. <td valign="top">directory where to store the expanded files.</td>
  38. <td align="center" valign="top">Yes</td>
  39. </tr>
  40. <tr>
  41. <td valign="top">overwrite</td>
  42. <td valign="top">Overwrite files, even if they are newer than the
  43. corresponding entries in the archive (true or false, default is
  44. true).</td>
  45. <td align="center" valign="top">No</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">compression</td>
  49. <td valign="top"><b>Note:</b> This attribute is only available for
  50. the <code>untar</code> task.<br>
  51. compression method. Allowable values are &quot;none&quot;,
  52. &quot;gzip&quot; and &quot;bzip2&quot;. Default is
  53. &quot;none&quot;.</td>
  54. <td valign="top" align="center">No</td>
  55. </tr>
  56. <tr>
  57. <td valign="top">encoding</td>
  58. <td valign="top"><b>Note:</b> This attribute is not available for
  59. the <code>untar</code> task.<br>
  60. The character encoding that has been used for filenames
  61. inside the zip file. For a list of possible values see <a
  62. href="http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html">http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html</a>.<br>
  63. Defaults to &quot;UTF8&quot;, use the magic value
  64. <code>native-encoding</code> for the platform's default character
  65. encoding.</td>
  66. <td align="center" valign="top">No</td>
  67. </tr>
  68. </table>
  69. <h3>Examples</h3>
  70. <blockquote>
  71. <p><code>&lt;unzip src=&quot;${tomcat_src}/tools-src.zip&quot; dest=&quot;${tools.home}&quot;/&gt;</code></p>
  72. </blockquote>
  73. <blockquote>
  74. <p><code>
  75. &lt;gunzip src=&quot;tools.tar.gz&quot;/&gt;<br>
  76. &lt;untar src=&quot;tools.tar&quot; dest=&quot;${tools.home}&quot;/&gt;
  77. </code></p>
  78. </blockquote>
  79. <blockquote>
  80. <p><pre>
  81. &lt;unzip src=&quot;${tomcat_src}/tools-src.zip&quot;
  82. dest=&quot;${tools.home}&quot;&gt;
  83. &lt;patternset&gt;
  84. &lt;include name=&quot;**/*.java&quot;/&gt;
  85. &lt;exclude name=&quot;**/Test*.java&quot;/&gt;
  86. &lt;/patternset&gt;
  87. &lt;/unzip&gt;
  88. </pre></p>
  89. </blockquote>
  90. <blockquote>
  91. <p><pre>
  92. &lt;unzip dest=&quot;${tools.home}&quot;&gt;
  93. &lt;patternset&gt;
  94. &lt;include name=&quot;**/*.java&quot;/&gt;
  95. &lt;exclude name=&quot;**/Test*.java&quot;/&gt;
  96. &lt;/patternset&gt;
  97. &lt;fileset dir=&quot;.&quot;&gt;
  98. &lt;include name=&quot;**/*.zip&quot;/&gt;
  99. &lt;exclude name=&quot;**/tmp*.zip&quot;/&gt;
  100. &lt;/fileset&gt;
  101. &lt;/unzip&gt;
  102. </pre></p>
  103. </blockquote>
  104. <blockquote>
  105. <p><pre>
  106. &lt;unzip src=&quot;apache-ant-bin.zip&quot; dest=&quot;${tools.home}&quot;&gt;
  107. &lt;patternset&gt;
  108. &lt;include name=&quot;apache-ant/lib/ant.jar&quot;/&gt;
  109. &lt;/patternset&gt;
  110. &lt;mapper type=&quot;flatten&quot;/&gt;
  111. &lt;/unzip&gt;
  112. </pre></p>
  113. </blockquote>
  114. <hr>
  115. <p align="center">Copyright &copy; 2000-2004 The Apache Software Foundation. All rights
  116. Reserved.</p>
  117. </body>
  118. </html>