java left logo
java middle logo
java right logo
 

Home arrow Other API Tips arrow Ant arrow How to use Unjar/Untar/Unwar/Unzip task
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4091
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to use Unjar/Untar/Unwar/Unzip task E-mail
User Rating: / 22
PoorBest 

Unjar/Untar/Unwar/Unzip

Description

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

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

Attribute Description Required
src archive file to expand. Yes, if filesets are not used.
dest directory where to store the expanded files. Yes
overwrite Overwrite files, even if they are newer than the corresponding entries in the archive (true or false, default is true). No
compression Note: This attribute is only available for the untar task.
compression method. Allowable values are "none", "gzip" and "bzip2". Default is "none".
No
encoding Note: This attribute is not available for the untar task.
The character encoding that has been used for filenames inside the zip file. For a list of possible values see http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html.
Defaults to "UTF8", use the magic value native-encoding for the platform's default character encoding.
No

Examples

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

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

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

        <include name="**/*.java"/>
        <exclude name="**/Test*.java"/>
    </patternset>
</unzip>

<unzip dest="${tools.home}">
    <patternset>
        <include name="**/*.java"/>
        <exclude name="**/Test*.java"/>

    </patternset>
    <fileset dir=".">
        <include name="**/*.zip"/>
        <exclude name="**/tmp*.zip"/>

    </fileset>
</unzip>

Source: Apache Ant


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.