ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Paulet <paul...@yahoo-inc.com>
Subject Re: Check if directory is empty or not
Date Thu, 26 Apr 2007 12:41:46 GMT
<property name="dir.target.tmp" value="my-path-to-tmp-dir"/>
<copy dir="my-root-path/my-dir-to-check" 
todir="${directory.target.temp}" includeEmptyDirs="false"/>
<available property="dir.is.NOT.empty" type="dir" 
file="${directory.target.temp}/my-dir-to-check"/>
<if><isset property="dir.is.NOT.empty"><then>
    <delete dir="${directory.target.temp}/my-dir-to-check" quiet="true"/>
    <fail message="Directory not empty !"/>
</then></if>

the src directory is not copied if it is empty !

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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message