You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by suresh inavolu <su...@yahoo.com> on 2009/01/22 14:40:54 UTC

Ant task to unzip to a dynamic folder

Hi,

I have some zip files in a directory like A/test1.zip, A/test2.zip and so on.
And I want to extract the contents into another folder B with subfolder same as the zip file name.

So, for input

A
+ - test1.zip
+ - test10.zip

Output should be:
B
+ - test1
+ - - <contents of test1 zip>
+ - test2
+ - - <contents of test2.zip>

However this simple code won't work because it unzip all the jars in the folder B (not in folder B/<zipfilename>/
<unzip dest="B">
  <fileset dir="A/*.zip">
</unzip>

Can I do this with Ant with out writing custom java code? Maybe by using the unzip, fileset and mapper type?

Thanks
Suresh