ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: How do I chain <mapper/> datatypes together (<mapperchain/>)?
Date Thu, 12 Jun 2003 08:15:16 GMT
I am currently working on a chaining extension to <mapper/>
but in the meantime, you may be able to use the regexp 
mapper:

    <copy todir="images">
      <fileset dir="src" includes="**/*.jpg"/>
      <mapper type="regexp" from=".*/(.*).jpg" to="Prefix_\1.jgp"/>
    </copy>

Peter.

On Wednesday 11 June 2003 18:40, Robert Rice wrote:
> I have a seemingly simple task I am trying to accomplish.  I wish to
> <copy/> or <move/> all the *.jpg files from a directory hierarchy ( files
> are located in multiple subdirectories ) into a flattened directory, and
> rename the files along the way.
>
> I have found that two separate <mapper/> datatypes, flatten and glob, will
> work to do the required transformations.  But only in unit, not combined
> in a chain.  Here was my first attempt that was not correct:
>
> <target name="dist-images" depends="init">
>     <copy todir="${dist.images.dir}"
> overwrite="yes">
>       <fileset dir="${build.images.dir}" includes="**/*.jpg" />
>       <mapper type="flatten" />
>       <mapper type="glob" from="*.jpg" to="${dist.images.mls.name}_*.jpg"
> />
>      </copy>
>   </target>
>
> I then followed it up with a rather inelegant solution.  Create a temp
> directory and <move/> or <copy/> twice:
>
> <target name="dist-images" depends="init">
>     <!-- make a temp directory -->
>     <mkdir dir="${dist.images.dir}/${dist.images.mls.name}" />
>     <copy todir="${dist.images.dir}/${dist.images.mls.name}"
> overwrite="yes">
>       <fileset dir="${build.images.dir}" includes="**/*.jpg" />
>       <mapper type="flatten" />
>      </copy>
>     <move todir="${dist.images.dir}" overwrite="yes">
>       <fileset dir="${dist.images.dir}/${dist.images.mls.name}"
> includes="*.jpg"
>  />
>       <mapper type="glob" from="*.jpg" to="${dist.images.mls.name}_*.jpg"
> />
>     </move>
>     <delete dir="${dist.images.dir}/${dist.images.mls.name}" />
>   </target>
>
> Is there something like a <mapperchain/> available?  Or, is there another
> approach that I can take?
>
> Thanks,
> Robert Rice
>
>
> ---------------------------------------------------------------------
> 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