ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <>
Subject Re: Test if directory is empty
Date Wed, 20 Mar 2002 11:31:15 GMT
On Wednesday 20 March 2002 11:51 am, Euan Guttridge wrote:
> I would like to be able to test if a directory is empty, and if it is not
> empty then perform a task. Any suggestions appreciated.

What i did was write a task which gives me the list of files in a directory 
as a string. If the string is empty, the dir is empty. Email me if you'd like 
that task. i wrote a custom task for that because when i tried to print 
filesets i got a string which looked like a reference address (not a readable 
string, anyway).

The xml looks like this:

<taskdef name="filelister" classname="de.einsurance.ant.FileListTask"/>
  outputproperty='build.cvs.maillist' includedirs="false" 
  delimiter=" " dir="${build.cvs.maildir}"
<condition property="cvs.doupdates">
  <!-- Set cvs.doupdates if the list of files in ${build.cvs.maildir} is not 
empty. -->
    <equals arg1="" arg2="${build.cvs.maillist}"/>

----- stephan
Generic Universal Computer Guy -
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
"I ain't gen'rally given to physicality of that nature but it saves
a lot of arguing." -- Nanny Ogg

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

View raw message