ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nissea <nils....@ngai.se>
Subject Re: Check if a directory is empty
Date Wed, 10 Oct 2007 06:44:46 GMT

OK, Thank you so much!




David Weintraub wrote:
> 
> Hmmm...
> 
> 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
> directories:
> 
> <project name="test" default="test" basedir=".">
> 
>     <path id="test.me">
>         <fileset dir="${basedir}/test.dir"/>
>     </path>
> 
>     <property name="test.me.property" refid="test.me"/>
> 
>     <condition property="empty.dir.flag">
>         <equals arg1="" arg2="${test.me.property}"/>
>     </condition>
> 
>     <target name="test1"
>         if="empty.dir.flag">
>         <echo>Directory "test.dir" is empty</echo>
>     </target>
> 
>     <target name="test"
>         depends="test1"
>         unless="empty.dir.flag">
>         <echo>Directory "test.dir" is not empty</echo>
>     </target>
> </project>
> 
> I was seeing if there was someway to do this via a filterchange, but
> couldn't see anyway.
> 
> --
> David Weintraub
> qazwart@gmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Check-if-a-directory-is-empty-tf4595246.html#a13130373
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message