ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nissea <nils....@ngai.se>
Subject Suppress echo of targetname
Date Thu, 15 Nov 2007 11:12:34 GMT

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


Mime
View raw message