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"/>
<filelister
  outputproperty='build.cvs.maillist' includedirs="false" 
  delimiter=" " dir="${build.cvs.maildir}"
  usefullpaths="true"
/>
<condition property="cvs.doupdates">
  <!-- Set cvs.doupdates if the list of files in ${build.cvs.maildir} is not 
empty. -->
 <not>
    <equals arg1="" arg2="${build.cvs.maillist}"/>
  </not>
</condition>


----- stephan
Generic Universal Computer Guy
[EMAIL PROTECTED] - http://www.einsurance.de
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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to