You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by nissea <ni...@ngai.se> on 2007/11/15 12:12:34 UTC

Suppress echo of targetname

Hi

I would like to check all files in a directory and if the filename starts
with "hash" the file should be removed.
My code looks like this:

<target name="delete" >
  <foreach target="deleteHash" param="Files" inheritall="true"> 
    <path>
      <fileset dir="C:\TEMP" casesensitive="no" />
    </path>
  </foreach>
</target>

<target name="deleteHash" >
  <if><contains string="${Files}" substring="hash" />
    <then>
      <delete file="${Files}" />
    </then>
  <else/>
  </if>
</target>

The target "delete" calls the target "deleteHash" for every file that are in
the directory "C:\TEMP". So if I have for example 1000 files in that
directory it will echo out "deleteHash:" 1000 times even if it's only one
file that starts with "hash". So I would like to remove the echo
"deleteHash:" or make some solution so I first check if the filename starts
with "hash" and if so call target "deleteHash". Any suggestions or help are
very appreciated, thanks.

//Nisse
-- 
View this message in context: http://www.nabble.com/Suppress-echo-of-targetname-tf4811207.html#a13765770
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org