Hi,

-----Original Message-----
From: Andres Alleva [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 29, 2007 9:39 PM
To: user@ant.apache.org
Subject: iterate a fileset

/*
I need to check, if every .jsp in my project, contains a tag like this 
<tag=xxxx>
How can i iterate a fileset and use <contains...> for each of my files?
*/

something like =

<script language="ruby">
<![CDATA[
         jspfound=Array.new
         Dir['**/*.jsp'].each do |path|
             File.open( path ) do |f|
               f.grep( /your regex for versiontag goes here/ ) do |line|
                 jspfound<<path<<','
               end
             end
           end
            $project.setProperty "jspfiles", jspfound.to_s.chop
 ]]>
</script>


if you have declared the targetdir that should be scanned
as ant property, i.e.

<property name="jspdir" value="C:/jspfiles" />
you use =

<script language="ruby">
<![CDATA[
         jspfound=Array.new
          Dir[$project.getProperty('jspdir')+'/*.jsp']
        ...

or recursive =

<script language="ruby">
<![CDATA[
         jspfound=Array.new
          Dir[$project.getProperty('jspdir')+'/**/*.jsp']
        ...

gives you the files in a ', ' separated list as property
if you need another separator change the line =
jspfound<<path<<','

into 

jspfound<<path<<'your separator char'


Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to