tags:

views:

25

answers:

1

I have a zip file with the following structure

apache-tomcat-6.0.26.zip apache-tomcat-6.0.26/webapps/manager

I want to copy just the manager folder into another dir

I tried

<copy todir="${tomcat.webapp.dir}/manager/" includeEmptyDirs="true">
 <zipfileset src="${tomcat.zip.file}/" >
  <patternset>
   <include name="apache-tomcat-${tomcat.version}/webapps/manager" />
  </patternset>
 </zipfileset>
</copy>

The output manager folder contains the following structure apache-tomcat-6.0.26/webapps/manager. I just need the manager folder and its content not its parents.

Tried changing the to but get an error msg that the folder is not an archieve

+1  A: 

Use a patternset to restrict the files to be extracted from the zip, coupled with a mapper that strips off the leading directory name

<unzip src="apache-tomcat-${tomcat.version}.zip" dest="${tomcat.webapp.dir}/manager">
    <patternset>
        <include name="**/webapps/manager/**"/>
    </patternset>
    <globmapper from="apache-tomcat-${tomcat.version}/webapps/manager/*" to="*"/>
</unzip>
Mark O'Connor
Awesome, Thanks a ton