ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cesar Martinez Izquierdo <cesar.marti...@iver.es>
Subject Re: Rename directories in Ant
Date Wed, 13 Jun 2007 14:31:41 GMT
Rebhan, Gilbert wrote:
>  
> 
> 
> Hi,
> 
> sorry, the mapper is wrong =
> <mapper id="renameMapper" type="glob" from="**\search" to="**\search_"
> />
> 
> must be =
> <mapper id="renameMapper" type="glob" from="*\search" to="*\search_"/>
> 
> the glob mapper seems to handle only single ' * '
> 
> Regards, Gilbert
> 
> 
> -----Original Message-----
> From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de] 
> Sent: Wednesday, June 13, 2007 2:50 PM
> To: Ant Users List
> Subject: RE: Rename directories in Ant
> 
>  
> Hi,
> 
> 
> -----Original Message-----
> From: Cesar Martinez Izquierdo [mailto:cesar.martinez@iver.es] 
> Sent: Wednesday, June 13, 2007 12:57 PM
> To: Ant Users List
> Subject: Re: Rename directories in Ant
> 
> /*
> Hi Qazwart, thanks for your reply.
> The problem is that I don't want to rename ONE directory, but ALL the
> "search" directories in a directory tree.
> And the "search" directory may be located inside another "search"
> directory, so getting the very first match is not enough... I need all
> of them to be replaced...
> I guess it needs to be performed using a totally different strategy. Any
> idea?
> */
> 
> maybe something like =
> 
> <mapper id="renameMapper" type="glob" from="**\search" to="**\search_"
> />
> 
>   <!-- first copy step, all but those search directories -->
>   <copy todir="Y:/test_" verbose="true">
>     <fileset dir="Y:/test" excludes="**/search/**" />
>   </copy>
> 
>   <!-- second copy step, copy all search dirs incl. rename to search_
> -->
>   <copy todir="Y:/test_" verbose="true">
>     <fileset dir="Y:/test" includes="**/*" />
>     <mapper refid="renameMapper" />
>   </copy>
> 
> 
> use on your own risk ;-)
> 
> i didn't get it how to put those two copy steps in one step only,
> but it seems to work anyway !?
> 
> 
> Regards, Gilbert
> 
Sorry, it doesn't seem to work.

For the sample directory tree I provided, it just copies

/tmp/myDir/test/hello/searchstrings/Hello.html

to

/tmp/myDir_/test/hello/searchstrings/Hello.html

but nothing else gets copied or renamed...


(For the record, the sample was:

/tmp/myDir/test/hello/search/Hello.html
/tmp/myDir/test/hello/search/nice/lists/search/Greetings.html
/tmp/myDir/test/hello/searchstrings/Hello.html
/tmp/myDir/search/Regards.html

which has to be renamed to:

/tmp/myDir/test/hello/search_/Hello.html
/tmp/myDir/test/hello/search_/nice/lists/search_/Greetings.html
/tmp/myDir/test/hello/searchstrings/Hello.html
/tmp/myDir/search_/Regards.html
)

Probably, something similar can be performed using the glob mapper as
you suggested, but it will fail when there is a 'search' directory
inside another 'search' directory (as far as I understand...).

Regards,

-- 
César Martínez Izquierdo
Equipo de desarrollo gvSIG
http://www.gvsig.gva.es

IVER T.I.
C/ Salamanca 50
46005 Valencia - Spain
http://www.iver.es


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


Mime
View raw message