I use your idea but i still have small problem. I install Ant-Contrib Tasks
but still get this error. I little modify your code

OUTPUT =

c:\Projekti\test>ant opencopy
Buildfile: build.xml

opencopy:

BUILD FAILE:
c:\projekti\test\build.xml:19: The following error occurred while executing
this line: C:\projekti\test\build.xml:23: Warning: could not find file
c:\Projekti\test\${from} to copy

Total time: 0 seconds

:: line 19 is <ac:for
:: line 23 is <copy

CODE =

<target name="opencopy">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<loadfile property="allfiles" srcFile="c:/Projekti/test/message.txt"/>
<ac:for list="${allfiles}" param="line">
<ac:sequential>
<ac:propertyregex property="from" input="@{srcFile}" regexp="(.*)=(.*)"
select="\1" override="true"/>
<ac:propertyregex property="to" input="@{srcFile}" regexp="(.*)=(.*)"
select="\2" override="true"/>
<copy file="${from}" tofile="${to}"/>
</ac:sequential>
</ac:for>
</target>

this is message.txt
/a/b/c.xml=/d/e/f.xml


--------- Original Message --------
From: Ant Users List <[email protected]>
To: [email protected] <[email protected]>
Subject: AW: Open and read file with ant and then copy
Date: 10/09/07 11:53

> Just an idea and not tested. Use '=' for separating source from target
name. Used AntContrib.
> 
> copy.txt
> --------
> /a/b/c.xml=/d/e/f.xml
> ....
> 
> 
> 
> &lt;loadfile property=&quot;allfiles&quot; file=&quot;copy.txt&quot;/&gt;
> &lt;ac:for list=&quot;${allfiles}&quot; param=&quot;line&quot;&gt;
>     &lt;sequential&gt;
>         &lt;ac:propertyregex property=&quot;from&quot;
input=&quot;@{file}&quot; regexp=&quot;(.*)=(.*)&quot; select=&quot;1&quot;
override=&quot;true&quot;/&gt;                   
>         &lt;ac:propertyregex property=&quot;to&quot;  
input=&quot;@{file}&quot; regexp=&quot;(.*)=(.*)&quot; select=&quot;2&quot;
override=&quot;true&quot;/&gt;
>         &lt;copy file=&quot;${from}&quot; tofile=&quot;${to}&quot;/&gt;
>     &lt;/&gt;
> &lt;/&gt;
> 
> 
> 
> Jan
> 
> 
> &gt;-----Ursprüngliche Nachricht-----
> &gt;Von: Mitja B. [mailto:[EMAIL PROTECTED] 
> &gt;Gesendet: Montag, 10. September 2007 10:32
> &gt;An: Materne, Jan (RZF)
> &gt;Betreff: Re: AW: Open and read file with ant and then copy
> &gt;
> &gt;We have few different customers which all have uniq files to 
> &gt;copy. We want
> &gt;that if is possible ant read project.txt file and in it are 
> &gt;all relative
> &gt;paths for files to copy, then ant will copy all this files.
> &gt;
> &gt;Is this possible?
> &gt;
> &gt;
> &gt;--------- Original Message --------
> &gt;From: [EMAIL PROTECTED]
> &gt;To: [email protected] &lt;[email protected]&gt;, [EMAIL PROTECTED]
> &gt;&lt;[EMAIL PROTECTED]&gt;
> &gt;Subject: AW: Open and read file with ant and then copy
> &gt;Date: 10/09/07 09:49
> &gt;
> &gt;&gt; What is the use case for using this project.txt?
> &gt;&gt; 
> &gt;&gt; Usually you copy a bunch of files with &amp;lt;copy
todir&amp;gt;&amp;lt;fileset
> &gt;dir=&amp;quot;from&amp;quot;&amp;gt;
> &gt;&gt; 
> &gt;&gt; 
> &gt;&gt; Jan 
> &gt;&gt; 
> &gt;&gt; &amp;gt;-----Ursprüngliche Nachricht-----
> &gt;&gt; &amp;gt;Von: Mitja B. [mailto:[EMAIL PROTECTED] 
> &gt;&gt; &amp;gt;Gesendet: Montag, 10. September 2007 09:29
> &gt;&gt; &amp;gt;An: [email protected]
> &gt;&gt; &amp;gt;Betreff: Open and read file with ant and then copy
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;I have big problem. I search but can not find and
solution.
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;We want to open some file, for example project.txt
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;in it we will have content like this
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;instmmconnection.xml projrtuconnection.xml
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;we want now that ant read this file and copy
connectiion.xml 
> &gt;&gt; &amp;gt;from instmm
> &gt;&gt; &amp;gt;directory to projrtu directory
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;How can we do this with ant, or even better is this
possible?
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;Thx
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;________________________________________________
> &gt;&gt; &amp;gt;Message sent using UebiMiau 2.7.10
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;
> &gt;&gt; 
> &gt;&amp;gt;-----------------------------------------------------------
> &gt;----------
> &gt;&gt; &amp;gt;To unsubscribe, e-mail: [EMAIL PROTECTED]
> &gt;&gt; &amp;gt;For additional commands, e-mail: [EMAIL PROTECTED]
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;
> &gt;&gt; 
> &gt;&gt; 
> &gt;
> &gt;________________________________________________
> &gt;Message sent using UebiMiau 2.7.10
> &gt;
> &gt;
> &gt;
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

________________________________________________
Message sent using UebiMiau 2.7.10



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

Reply via email to