开发者

List directories in a folder, ignore sub directories ANT

Basically I have the following structure for a javadoc:

build
+---javadoc
+-------Module A
+-------Module B
+---Index.html

Module X are folders. I'm trying to list the folders there, ignoring subfolders, so I can create the main index. So far This is what I have:

<target name="x">
    <dirset开发者_如何学JAVA id="dist.contents" dir="build/javadoc" excludes="build/javadoc/*/**"/>
    <property name="prop.dist.contents" refid="dist.contents"/>
    <echo>${prop.dist.contents}</echo>
</target>

But it gives me both the the Module's folder and all its subfolders. I know it should be a little detail but I can't figure it out.


Change to use includes instead of excludes, and specify a wildcard that won't traverse sub-directories:

<dirset id="dist.contents" dir="build/javadoc" includes="*"/>

Further restrict the wildcard if needed:

<dirset id="dist.contents" dir="build/javadoc" includes="Module *"/>

Here's the docs on directory-based tasks.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜