Reputation: 3252
I have an ant target for creating zip like this -
<zip destfile="${dist}/myzip.zip">
<zipfileset dir="docs/manual" prefix="docs/userguide"/>
</zip>
This basically creates archive myzip.zip
with all the files and directories under docs/manual
prefixed with docs/userguide in the archive.
But I don' want to include all the directories under docs/manual
to be copied into the archive,
I have a directory called old
under docs/manual
which I want to exclude...How to achieve this?
Upvotes: 7
Views: 19491
Reputation: 768
This was the only one that worked for me for removal of specific file pattern
<zip destfile="${bin.dir}/boo.jar">
<zipfileset dir="${classes.dir}" excludes="**/*/BooCreator*.class"/>
</zip>
Upvotes: 0
Reputation: 31
you can exclude an entire directory by this:
<zipfileset dir="docs/manual" prefix="docs/userguide" exlcudes="**/old/**"/>
Upvotes: 3
Reputation: 298818
From the ZipFileSet reference page
<zipfileset>
supports all attributes of<fileset>
in addition to those listed below.
So see FileSet for reference.
This is how you do it:
<zipfileset dir="docs/manual" prefix="docs/userguide">
<exclude name="old/**"/>
</zipfileset>
or inline as attribute:
<zipfileset dir="docs/manual" prefix="docs/userguide" exclude="old/**" />
Update: Using wildcards now instead of simple name.
Upvotes: 12
Reputation: 24630
<zip destfile="${dist}/myzip.zip" excludes="docs/manual/old/**">
<zipfileset dir="docs/manual" prefix="docs/userguide"/>
</zip>
Upvotes: 1