如何在ANT中测试一下目录是否为空? [英] How do I test to see that a directory is empty in ANT?
本文介绍了如何在ANT中测试一下目录是否为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
你可以使用 pathconvert
任务要做到这一点, setonempty
属性。请参阅此示例一个用例。
< pathconvert refid =myfileset
property =fileset.notempty
setonempty =false/>
将只设置属性 fileset.notempty
如果这些refid的文件集是 myfileset
不是空的。
你只需要定义 myfileset
与您的目录,没有排除确定获取目录空测试:
< fileset dir =foo / barid =myfileset/>
How can one test to see that a directory is empty in ant?
解决方案
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"/>
will set the property fileset.notempty
only if the fileset those refid is myfileset
is not empty.
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屋!
查看全文