ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sunil Prabhakaran" <sunilprabhaka...@gmail.com>
Subject Re: How do I strip off part of the file name when I do a ANT copy
Date Fri, 19 Oct 2007 19:19:05 GMT
try the ANT contrib task propertyregexp
http://ant-contrib.sourceforge.net/tasks/tasks/propertyregex.html

One example would be to use it this way

<propertyregex property="dest.file"
              input="${current.file}"
              regexp="(.*)\.TEMPLATE"
              select="\1"
              casesensitive="false" />

<copy file="${current.file}" flatten="true"
tofile="${dir.dist}/${current.env}/${dest.file}">
       <filterchain>
           <expandproperties/>
       </filterchain>
   </copy>

regards
Sunil Prabhakaran

On 10/19/07, Eric Wood <EWood@llbean.com> wrote:
>
> I have a bunch of templates that I expandproperties on to produce
> environment specific versions using the following code:
>
>       <copy file="${current.file}" flatten="true"
> todir="${dir.dist}/${current.env}">
>         <filterchain>
>             <expandproperties/>
>         </filterchain>
>     </copy>
>
> The file name ( in the property ${current.file} ) contains the name
> "TEMPLATE" and I want to remove once I perform this move. For example:
>
>         log4j.properties.TEMPLATE
>
> that I want to strip the ".TEMPLATE" part when I copy this file. What is
> the best way to accomplish this task?
>
> Eric
>

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


Mime
View raw message