Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
Rename directories in Ant

Rename directories in Ant

2007-06-13       - By Cesar Martinez Izquierdo
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

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

C?sar Mart?nez Izquierdo
Equipo de desarrollo gvSIG

C/ Salamanca 50
46005 Valencia - Spain

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

©2008 - Jax Systems, LLC, U.S.A.