ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: AW: Open and read file with ant and then copy
Date Mon, 10 Sep 2007 12:55:06 GMT
>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
>
><target name="opencopy">
><taskdef resource="net/sf/antcontrib/antlib.xml"/>

= add ac-task 

><loadfile property="allfiles" srcFile="c:/Projekti/test/message.txt"/>

= ${allfiles} contains the whole file

><ac:for list="${allfiles}" param="line">

= iterate over each line (implizit delimiter="${line.separator}") and
store each line in @{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"/>

= @{srcFile} is not set, therefore this does nothing useful; you have to
use @{line} instead
= splits the line on the '=' delimiter and stores the parts into ${from}
and ${to}

><copy file="${from}" tofile="${to}"/>

= should copy ${from} to ${to}



Jan

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


Mime
View raw message