ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Unzip task question
Date Wed, 10 Sep 2008 12:44:33 GMT
On Wed, 10 Sep 2008, Hans Schwaebli <hans_schwaebli@yahoo.com> wrote:

> I want to unzip a part of the zip file.
> 
> For example in the zipfile there are these folders:
> 
> -a
>  -b
>  -c
>  -d
>   -e
>  -f
> 
> I want just folder "e" to export. But if I do, then it creates the
> whole structure in the output folder:
> 
> -a
>  -d
>   -e
> 
> I use:
> 
>         <unzip src="zipfile.zip" dest="c:/tmp">
>             <patternset>
>                 <include name="/**/e/**/*"/>
>             </patternset>
>         </unzip>
> 
> Moving and deleting folders afterwards is a workaround. Is there any
> real solution in Ant for this?


Yes, add a mapper to the task, something like (untested)

<unzip src="zipfile.zip" dest="c:/tmp">
  <patternset>
    <include name="/**/e/**/*"/>
  </patternset>
  <regexpmapper from=".*/e/(.*)" to="e/\1"/>
</unzip>

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message