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 10:57:14 GMT
Qazwart wrote:
> What version of Ant are you using? You seem to take the hard way:
> 
> If you're using at least version 1.3, you can simply do this:
> 
> <move file="/tmp/myDir/test/hello/search"
>     todir="/tmp/myDir/test/hello/search_"/>
> 
> If it's earlier than version 1.3:
> 
> <move todir="/tmp/myDir/test/hello/search_">
>    <fileset dir="/tmp/myDir/test/hello/search"/>
> </move>
> 
> No need to use a mapper or anything:
> 
> BTW, the problem you're running into is that regex is naturally greedy,
> so it always takes the biggest chunk it can to make the match. Since you
> can easily define the directory using simpler globbing expressions, you
> could have use that. Or, you can use the "Reluctant" qualifier which
> will only take the very first match it can find:
> 
> This: <regexpmapper from="(.*?)(${oldValue})(.*)" to="\1${newValue}\3"
> Instead of: <regexpmapper from="(.*)(${oldValue})(.*)" to="\1${newValue}\3"
> 

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?

-- 
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