Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
AW: Changing directory structure in copy

AW: Changing directory structure in copy

2007-08-07       - By Jan.Materne@(protected)
Reply:     1     2     3  

A mapper maps file names, thats right.
But a "file name" in Java is the complete path...

The mapper gets the complete path to the file and you could apply the renaming,
e.g. using a <globmapper>.
Otherwise the <package>/<unpackage> mappers wouldnt make sence, right? ;-)

Problem could occur with your ".." in your source layout... as ".." is not part
of a file-path.


<property name="from.dir" location=".."/>      !! location is resolved to the
actual path ;)
<property name="to.dir" location="dbutil"/>
<copy>
   <fileset dir="${from.dir}" ... />
   <globmapper from="${from.dir}/*/db" to="${to.dir}"/>


not tested ...


Not sure if running in -debug mode would show the mapping (I think not :-( ).
For testing (without really copying) you could try <pathconvert> (just replace
<copy> by <pathconvert>...)


Jan

>-----Urspr?ngliche Nachricht-----
>Von: David Weintraub [mailto:qazwart@(protected)]
>Gesendet: Montag, 6. August 2007 22:40
>An: Ant Users List
>Betreff: Changing directory structure in copy
>
>I need to copy the following directories:
>
>    ../dir1/db/*
>    ../dir2/db/*
>    ../foo/db/*
>    ../bar/db/*
>
>To:
>
>    dbutil/dir1
>    dbutil/dir2
>    dbutil/foo
>    dbutil/bar
>
>Basically, I want to copy all directories:
>
>    ../*/db
>
>to:
>
>    dbutil/*
>
>I looked at mapper, but it seems to only map file names. Is there a
>way to map directories in Ant without using any "optional" tasks,
>manually listing the directories, or using shell callouts?
>
>--
>David Weintraub
>qazwart@(protected)
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@(protected)
>For additional commands, e-mail: user-help@(protected)
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.