ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peterrei...@apache.org>
Subject Re: Replace extension with mapper
Date Thu, 03 Feb 2005 13:33:39 GMT
Ant's globmapper does not support more that one "*".
You need to use a regexpmapper, for example:

  <target name="h">
    <delete dir="hh" quiet="yes"/>
    <delete dir="newdir" quiet="yes"/>
    <mkdir dir="hh"/>
    <mkdir dir="hh/subdir"/>
    <touch file="hh/x.html"/>
    <touch file="hh/y.htm"/>
    <touch file="hh/subdir/x.html"/>
    <copy todir="newdir">
      <fileset dir="hh">
        <include name = "**/*.html"/>
        <include name = "**/*.htm"/>
      </fileset>
      <mapper>
        <regexpmapper from="(.*)\.html*" to="\1.xhtml"/>
      </mapper>
    </copy>
  </target>

Robert Soesemann wrote:

>While copy HTML files (*.htm or *.html) to another folder, I want to
>rename the extension of all those files to *.xhtml.
>
>I tried this, but it didn't work. Can you help?	
>
><copy todir="${regexp_dir}">
>	<fileset dir="${html_dir}">
>		<include name="**/*.htm"/>
>		include name="**/*.html"/>
>	</fileset>
>	<mapper type="glob" from="*.htm*" to="*.xhtml"/>
></copy>	
>
>Best regards,
>
>Robert
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


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


Mime
View raw message