Hello,

the following script sets a property depending whether
a given folder is empty or not:

<project>
    <mkdir dir="empty"/>
    <fileset dir="empty" id="empty.fs"/>
    <pathconvert setonempty="false"
        property="emptyprop"
        refid="empty.fs"
        dirsep="${file.separator}"
        pathsep="${path.separator}">
    </pathconvert>
    <echo>$${emptyprop} is ${emptyprop}</echo>

    <mkdir dir="notempty"/>
    <touch file="notempty/file"/>
    <fileset dir="notempty" id="not.empty.fs"/>
    <pathconvert setonempty="false"
        property="notemptyprop"
        refid="not.empty.fs"
        dirsep="${file.separator}"
        pathsep="${path.separator}">
    </pathconvert>
    <echo>$${notemptyprop} is ${notemptyprop}</echo>
</project>

You might want to isolate the above code in a
<macrodef> for easier reusing.

Note that this is pure ant solution. You can easily do
the check as well using <scriptdef> with javascript
for example.

HTH Ivan

--- Michael Owen <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> How do can test if a folder is empty?
> 
> Mike
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to