ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: AW: Open and read file with ant and then copy
Date Mon, 10 Sep 2007 12:55:06 GMT
>c:\projekti\test\build.xml:19: The following error occurred while
>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: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}


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message