You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Leif Bladt <le...@bladt.info> on 2009/08/19 09:03:00 UTC

Map file names in copy task

Hi list,

I defined a bunch of files with a path (or a file set) to copy them in  
several tasks. Now I would like to map some of the filenames, where  
other should keep their original file name. With the mapping below,  
all not defined files won't get copied. Is there a possibility IU've  
overseen to achieve this behaviour, without define all files also in  
the mapping?

<chainedmapper>
     <flattenmapper/>
     <mapper>
         <globmapper from="file1" to="mapped_file1"/>
         <globmapper from="file2" to="mapped_file2"/>
     </mapper>
</chainedmapper>

Thanks for your help!

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


Re: Map file names in copy task

Posted by Leif Bladt <le...@bladt.info>.
As I read my post again, I think I can clarify this a bit with more  
code:

<path id="files.to.copy">
     <pathelement location="fileA" />
     <pathelement location="fileB" />
     <pathelement location="fileC" />
</path>

<chainedmapper id="files.mapping">
    <flattenmapper/>
    <mapper>
        <globmapper from="fileA" to="mapped_fileA"/>
        <globmapper from="fileB" to="mapped_fileB"/>
    </mapper>
</chainedmapper>

<copy todir="newPlace">
     <path>
         <path refid="files.to.copy" />
     </path>
     <mapper refid="files.mapping" />
</copy>

So, what I want is, that all the files get copied. If there is a  
mapping for the file name use the mapped file name, otherwise use the  
original file name.

Is there another way to achieve this, without defining the identity  
mapping "manually" in the mapper?


Cheers,
Leif


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