ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Rice <rob...@windermere.com>
Subject How do I chain <mapper/> datatypes together (<mapperchain/>)?
Date Wed, 11 Jun 2003 17:40:35 GMT
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


Mime
View raw message