How can I unzip a specific folder with Ant?
Specifically, I have downloaded apache-tomcat-6.0.29.zip which contains the folder \"apache-tomcat-6.0.29\". I want Ant to u
You can use a mapper within the unzip task to change the paths written.
<unzip dest="${release.dir}/image/tomcat" src="${tomcat.zip}">
<patternset>
<include name="apache-tomcat-6.0.29/*"/>
</patternset>
<mapper>
<globmapper from="apache-tomcat-6.0.29/*" to="*"/>
</mapper>
</unzip>
<unzip dest="${release.dir}/image/tomcat" src="${tomcat.zip}">
<patternset>
<!-- add another star -->
<include name="apache-tomcat-6.0.29/**"/>
</patternset>
</unzip>
The following works as long that there is a single directory in the tomcat archive.
<untar src="${release.dir}" dest="${tomcat.tar.gz}" compression="gzip">
<cutdirsmapper dirs="1" />
</untar>