ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Rich <>
Subject Re: Check if directory is empty or not
Date Sat, 21 Apr 2007 06:36:01 GMT
A little while ago Jan Materne suggested the following for another 
question about files in a directory.
<property name="includes" value="these;files;must;be;present"/>
<property name="includes.length" value="5"/>
<property name="dir" value="dir"/>

<condition propery="all-files-present">
   <length length="${includes.length}">
       <fileset id="fs" dir="${dir}" includes="${includes}"/>
Can you use something similar, maybe with a * or **/*, and check if the 
length of the file list is 0?
HTH Bill

Anderson, Rob (Global Trade) wrote:
> I have a build.xml that runs a custom task to import documents into a
> document management system. After the custom import task runs I'd like
> to check the load directory for anything that may have been left behind.
> If the directory is not empty my build should fail.
> Is there an easy way to check if a directory is empty or not?
> Thanks in advance.
> ______________________
> Robert Anderson
> Sr. System Engineer
> Nike - Global Trade IT
> 503-532-6803
> Never let me slip, cuz if I slip, then I'm slippin. - Dr. Dre

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

View raw message