如何测试看到一个目录是ANT空的? [英] How do I test to see that a directory is empty in ANT?

查看:104
本文介绍了如何测试看到一个目录是ANT空的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何能一个测试看到一个目录是蚂蚁空的?

How can one test to see that a directory is empty in ant?

推荐答案

您可以使用 pathconvert 任务,要做到这一点,使用 setonempty 属性。见<一href=\"http://mail-archives.apache.org/mod_mbox/ant-user/200512.mbox/%3C4397C619.5010106@gmx.de%3E\">this例如一个用例。

You can use the pathconvert task to do that, with the setonempty property. See this example for an use case.

<pathconvert refid="myfileset"
             property="fileset.notempty"
             setonempty="false"/>

将设置属性 fileset.notempty 只有那些文件集是RE​​FID myfileset 不是空的。

will set the property fileset.notempty only if the fileset those refid is myfileset is not empty.

您只需要定义 myfileset 与目录,并没有排除做得到的目录空测试:

You just have to define myfileset with your directory, and no excludes do get a directory empty test:

<fileset dir="foo/bar" id="myfileset"/>

这篇关于如何测试看到一个目录是ANT空的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆