You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ex...@tietoenator.com on 2008/07/10 15:19:33 UTC

Ant task to find in files

Hi there,

I'd like to seach the files in a fileset and fail my build if any file
contains a certain string.

Is there any functionality in Ant that can do this? I've seen the
Replace task, but all I want is a Find task.

It seems such an obvious emmision, that I'm sure I just don't know what
to look for.

Thanks,
Manish

RE: Ant task to find in files

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
 

-----Original Message-----
From: Ext.Manish.Shah@tietoenator.com
[mailto:Ext.Manish.Shah@tietoenator.com] 
Sent: Thursday, July 10, 2008 3:20 PM
To: user@ant.apache.org
Subject: Ant task to find in files

/*
Hi there,

I'd like to seach the files in a fileset and fail my build if any file
contains a certain string.

Is there any functionality in Ant that can do this? I've seen the
Replace task, but all I want is a Find task.
*/

maybe something like =

<pathconvert property="target.found" pathsep=" " setonempty="false">
  <path>
    <fileset dir="Y:/test" includes="**/*.conf">
      <contains text="foobar" casesensitive="no" />
    </fileset>
  </path>
</pathconvert>

<fail if="target.found">Oops, found ... </fail>


Regards, Gilbert

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