开发者

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:

  1. Change the name of your destfile to "C:\Projects\example\builds\logs.zip"
  2. Set your basedir to "C:\Projects\example\"
  3. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜