2

How to unzip multiple files with Ant? I am using:

<unzip dest="./out">
    <patternset>
            <include name="**/*.zip"/>
    </patternset>
    <fileset dir="./in">
        <include name="**/*.zip"/>
    </fileset>
</unzip>

From the output it looks like ANT is correctly finding my files but nothing gets extracted:

[unzip] Expanding: c:\temp\in\test1.zip into c:\temp\out
[unzip] Expanding: c:\temp\in\test2.zip into c:\temp\out

BUILD SUCCESSFUL Total time: 0 seconds

I can't figure out what I am doing wrong.

tony
  • 823
  • 2
  • 16
  • 25

1 Answers1

2

From the documentation

PatternSets are used to select files to extract from the archive. If no patternset is used, all files are extracted.

My guess is thus that your zip files don't contain any zip file, and thus nothing is extracted, since you told Ant to only extract zip files from your zip files.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
  • In my directory I have test1.zip and test2.zip. I want ant to extract everything inside them and save it to out – tony Oct 07 '14 at 17:51
  • 1
    Have you read my answer? Why are you using a patternset? The patternset you're using says to Ant: "I want to only extract files named *.zip from the zip files. The other files shouldn't be extracted". Remove this patternset. – JB Nizet Oct 07 '14 at 17:53
  • I think I just figured out, based on your comment of course. I thought patternset was to select what files to unzip and not what to unzip from the zip files. Thanks! – tony Oct 07 '14 at 17:54
  • 1
    As soon as I removed patternset, it worked: – tony Oct 07 '14 at 17:54