Ooops...it appears you might have a problem (or two)... First off... I do not believe you can nest abritary task nodes within a <fail> task...the only sub-element permitted is a single <condition> element...I will defer to the ANT docs but I believe that is right
Based on what you said...you want to delete the files if a file is available. The problem is: Either the <available> task will find your 'log' file and the property 'error.log.exist' at which point the <fail> task will trigger which will emit your message to the console, HOWEVER the ant script will then stop...will not delete the files ON the other hand if <available> task is unable to find the file, the property will not be set...the <fail> will not trigger...however the <delete> will still execute. My $.02 cents worth, Ninju ----- Original Message ---- From: Mikael Petterson (KI/EAB) <[EMAIL PROTECTED]> To: user@ant.apache.org Sent: Tuesday, February 6, 2007 12:57:03 PM Subject: Delete files if error log exist Hi, I would like to confirm with you experts if I can write ( as below) to delete some files if an error log exist. Or is there a better way? Cheers, //mikael <available file="${log.dir}/${log}" type="file" property="error.log.exist"/> <fail message="ERROR: Probable errors in the mom. Check 'error.log' in ${log.dir}" if="error.log.exist"> <!--When generation fails. Remove all files since we don't want the wrong files to be checked in.--> <delete> <fileset dir="${output.dir}/${gen.pkg}" includes="**/*.java"/> </delete> </fail> ____________________________________________________________________________________ Don't get soaked. Take a quick peak at the forecast with the Yahoo! Search weather shortcut. http://tools.search.yahoo.com/shortcuts/#loc_weather --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]