ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <>
Subject Re: Check if a directory is empty
Date Tue, 09 Oct 2007 18:03:40 GMT

You could create a PATH ID, then convert that over to a property, then
check that the property is not empty. The following build.xml has been
tested and checks for the presents of files in that directory.
However, it will report a directory as empty if it contains just empty

<project name="test" default="test" basedir=".">

    <path id="">
        <fileset dir="${basedir}/test.dir"/>

    <property name="" refid=""/>

    <condition property="empty.dir.flag">
        <equals arg1="" arg2="${}"/>

    <target name="test1"
        <echo>Directory "test.dir" is empty</echo>

    <target name="test"
        <echo>Directory "test.dir" is not empty</echo>

I was seeing if there was someway to do this via a filterchange, but
couldn't see anyway.

David Weintraub

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message