更新时间:2023-11-29 15:34:10
你可以使用 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"/>