Index: docs/manual/CoreTasks/unzip.html =================================================================== RCS file: /home/cvspublic/ant/docs/manual/CoreTasks/unzip.html,v retrieving revision 1.11 diff -b -u -r1.11 unzip.html --- docs/manual/CoreTasks/unzip.html 4 Sep 2002 11:05:16 -0000 1.11 +++ docs/manual/CoreTasks/unzip.html 18 May 2003 01:27:48 -0000 @@ -9,15 +9,9 @@

Unjar/Untar/Unwar/Unzip

Description

-

Unzips a zip-, war-, tar- or jarfile.

+

Unzips zip-, war-, tar- or jarfile(s).

For JDK 1.1 "last modified time" field is set to current time instead of being carried from the archive file.

-

PatternSets are used to select files to extract -from the archive. If no patternset is used, all files are extracted. -

-

FileSets may be used used to select archived files -to perform unarchival upon. -

File permissions will not be restored on extracted files.

The untar task recognizes the long pathname entries used by GNU tar.

Parameters

@@ -53,16 +47,40 @@ +

Parameters specified as nested elements

+ +

fileset

+

FileSets may be used used to select archived files + to perform unarchival upon. +

+ +

patternset

+

PatternSets are used to select files to extract + from the archive. If no patternset is used, all files are extracted. +

+ +

mapper

+

A nested mapper element can be used + to map archive file names to extraction directories. The mapper will map the + src or fileset file names to a directory name that is appended to dest to + create the final destination directory. New directories will be created if they + don't already exist. Unmatched archives will not be extracted. If no mapper is + specified all of the archive files will be extracted into the single dest + directory.

+

Examples

<unzip src="${tomcat_src}/tools-src.zip" dest="${tools.home}"/>

+

Unzips ${tomcat_src}/tools-src.zip into the ${tools.home} directory

<gunzip src="tools.tar.gz"/>
<untar src="tools.tar" dest="${tools.home}"/>

+

Gunzips the tools.tar.gz file into tools.tar and untars that into the +${tools.home} directory

 <unzip src="${tomcat_src}/tools-src.zip"
@@ -74,6 +92,9 @@
 </unzip>
 

+

Unzips any file in the ${tomcat_src}/tools-src.zip archive that ends with +".java", unless the file name starts with "Test", into the ${tools.home} +directory

 <unzip dest="${tools.home}">
@@ -88,8 +109,31 @@
 </unzip>
 

+

Unzips any file that ends with ".java", unless the file name starts with +"Test", into the ${tools.home} directory from any archive in the current +directory or subdirectories that ends in ".zip", but doesn't start with +"tmp".

+
+

<unjar dest="${dir.preverified}">
+  <fileset dir="${dir.src}">
+    <include name="*.jar" />
+    <include name="*.zip" />
+  </fileset>
+  <mapper type="regexp" from="^(.*)\.(jar|zip)$$" to="\1/" />
+</unjar>
+

+
+ +

Unpacks all files ending in .jar or .zip in the ${dir.src} directory and puts +the contents of each into a subdirectory of the ${dir.preverified} +directory. Each subdirectory is named the same name as the original archive file +that its' contents came from, but without the trailing .jar or .zip. For +example, the contents of src/purifier.zip and +src/ant.jar will be extracted to preverified/purifier/ +and preverified/ant/ directories respectively.

+
-

Copyright © 2000-2002 Apache Software Foundation. All rights +

Copyright © 2000-2003 Apache Software Foundation. All rights Reserved.