I believe your problem is that you need a sequential element prior to your
for...
For example:
<ac:for param="i" list="${file1}">
<sequenrial>
<ac:for param="j" list="${file2}">
<sequential>
<echo>@{i}@{j}</echo>
<echo>copying....</echo>
<property name="src.dir" value="/home/name/svn_repo/dir" />
<property name="dest.dir" value="/home/name/mapp" />
<copy todir="${dest.dir}/@{j}">
<fileset dir="${src.dir}/@{i}">
</fileset>
</copy>
</sequential>
</ac:for>
</sequential>
</ac:for>
On Fri, 3 Aug 2012, Shweta wrote:
I have two txt files –
File1.txt – contains list of src dir
File2.txt – contains list of dest dir
I need to do the copy using a loop from src dir to dest dir
File1.txt (SVN dire structure)
abcBIN
abcBIN/fdPro
…..so on
File2.txt (LINUX structure)
apps/xxx/yyy/bin/abc
apps/xxx/yyy/bin/abc/fdpro
….so on
I need to copy the abcBIN ‘s files dir to apps/xxx/yyy/bin/abc and so on.
One to one mapping.
<project xmlns:ac="antlib:net.sf.antcontrib">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="path-to-ant-contrib.jar"/>
</classpath>
</taskdef>
<loadfile property="file1" srcfile="File1.txt"/>
<loadfile property="file2" srcfile="File2.txt"/>
<ac:for param="i" list="${file1}">
<ac:for param="j" list="${file2}">
<sequential>
<echo>@{i}@{j}</echo>
<echo>copying....</echo>
<property name="src.dir" value="/home/name/svn_repo/dir" />
<property name="dest.dir" value="/home/name/mapp" />
<copy todir="${dest.dir}/@{j}"> <fileset dir="${src.dir}/@{i}">
</fileset>
</copy>
</sequential>
</ac:for>
</ac:for>
</project>
It is not working though
I am getting an error “ac:for doesn't support the nested "for" element”
I can’t use UNIX shell or Perl. It has to be done in ANT
Please let me know if anyone has a better solution.
--
View this message in context:
http://ant.1045680.n5.nabble.com/nested-ant-cntrib-for-loops-tp1340132p5713435.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org
Scot P. Floess RHCT (Certificate Number 605010084735240)
Chief Architect FlossWare http://sourceforge.net/projects/flossware
http://flossware.sourceforge.net
https://github.com/organizations/FlossWare
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org