ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <>
Subject RE: Renaming the directories recursively
Date Wed, 27 Mar 2002 03:32:16 GMT

> -----Original Message-----
> From:
> []
> Sent: Wednesday, 27 March 2002 12:38 PM
> To: Ant Users List
> Subject: Renaming the directories recursively
> I want to rename the directories only recursively. Basically, I want to
> rename _com/_alltel/_ebusiness/........ to
> com/alltel/ebusiness............... I checked out the documentation, and
> figured out how to rename the files.
> This is the code I am trying to useand it renames only the top most
> directory leaving the subdirectories without renaming.
> <target name="move" >
>      <move todir="." >
>      <fileset dir="." includes="**" >
>      </fileset>
>      <mapper type="glob" from="_*" to="*"/>
>      </move>
>      </target>
>      Can somebody help me out ?

The names that get passed to the mapper are paths relative to the root
directory of the source file set.  So, in your case, the mapper will be
getting passed names like


This is why you're seeing only the top most directory being renamed - the
glob mapper is removing the first '_' only from all of the names.

Unfortunately, to solve your particular problem, I think you will have to
write your own mapper implementation.  It's not particularaly hard -
implement FileNameMapper to do the appropriate conversion, compile it up,
and use <mapper classname=".." /> to use it.

Of course, that is a rather odd directory layout you've got - why can't you
get rid of the underscores from the directory names and give the whole
renaming problem a miss?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message