Note that there are some explanatory texts on larger screens.

plurals
  1. POAnt Nested Loop
    text
    copied!<p>I have two txt files: File1.txt – contains list of src dir; and File2.txt – contains list of dest dir. I need to do the copy using a loop from src dir to dest dir. </p> <p>File1.txt (SVN dire structure)</p> <pre><code>abcBIN abcBIN/fdPro ...so on </code></pre> <p>File2.txt (LINUX structure) </p> <pre><code>apps/xxx/yyy/bin/abc apps/xxx/yyy/bin/abc/fdpro ...so on </code></pre> <p>I need to copy the abcBIN files dir to apps/xxx/yyy/bin/abc and so on. One to one mapping.</p> <pre><code>&lt;project xmlns:ac="antlib:net.sf.antcontrib"&gt; &lt;taskdef resource="net/sf/antcontrib/antcontrib.properties"&gt; &lt;classpath&gt; &lt;pathelement location="path-to-ant-contrib.jar"/&gt; &lt;/classpath&gt; &lt;/taskdef&gt; &lt;loadfile property="file1" srcfile="File1.txt"/&gt; &lt;loadfile property="file2" srcfile="File2.txt"/&gt; &lt;ac:for param="i" list="${file1}"&gt; &lt;ac:for param="j" list="${file2}"&gt; &lt;sequential&gt; &lt;echo&gt;@{i}@{j}&lt;/echo&gt; &lt;echo&gt;copying....&lt;/echo&gt; &lt;property name="src.dir" value="/home/name/svn_repo/dir" /&gt; &lt;property name="dest.dir" value="/home/name/mapp" /&gt; &lt;copy todir="${dest.dir}/@{j}"&gt; &lt;fileset dir="${src.dir}/@{i}"&gt; &lt;/fileset&gt; &lt;/copy&gt; &lt;/sequential&gt; &lt;/ac:for&gt; &lt;/ac:for&gt; &lt;/project&gt; </code></pre> <p>It is not working though.</p> <p>I am getting an error:</p> <pre><code>ac:for doesn't support the nested "for" element </code></pre> <p>I can’t use UNIX shell or Perl. It has to be done in Ant.</p> <p>Please let me know if you have any better idea about the nested loop in Ant.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload