ant zip; exclude all sub-directories and files
When creating a zip from ant, how can I exclude all sub directories and files from a given directory?
I have tried the following but it doesn't seem to prevent them from being included in the zip
<target name="zip">
<zip destfile="C:\Projects\example\builds\.zip"
excludes="C:\Projects\example开发者_开发百科\logs\**\*.*">
...
...
</zip>
</target>
From reading the documentation, and from reading the ant definitive guide I would assume that **\
should exclude any directory, and *.*
would exclude any file of any extension
I want to include the logs
directory, but nothing inside it.
I would recommend the following:
- Change the name of your
destfile
to"C:\Projects\example\builds\logs.zip"
- Set your
basedir
to"C:\Projects\example\"
- Change your
excludes
value to"C:\Projects\example\logs\**\*"
(that means any file)
Another option might be to use the project
-defined basedir
, and change all your paths to relative UNIX-like values.
精彩评论