Ant Example: Check if a directory is empty or if specific file exists.
1. Check is empty directory:
<if>
2. Check if file exists:
<if>
<available file="path_to_file"/>
<then>
<!-- File Exists -->
</then>
<else>
<!-- File Doesn't Exists -->
</else>
</if>
<if>
<length length="0" when="greater">
<fileset dir="yourDirectory" followsymlinks="false"/>
</length>
<then>
<!-- Dir Not Empty -->
</then>
<else>
<!-- Dir Empty -->
</else>
</if>
2. Check if file exists:
<if>
<available file="path_to_file"/>
<then>
<!-- File Exists -->
</then>
<else>
<!-- File Doesn't Exists -->
</else>
</if>
Comments
Post a Comment