ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florijan Stamenkovic <>
Subject Re: rename files in directory and subdirectory
Date Thu, 07 Aug 2008 14:35:54 GMT

First, are you sure this should be in your ant build? It sounds like  
a one time process of porting the files to your new naming schema. If  
that is the case, it might be simplest to just use something like  

If however for some reason you really need this in your ant, here is  
how it could look using a regex based move. Note I am writing this in  
Mail, so there might be errors, and also, do this first on a copy of  
your project(s), just to make sure it works as you want it to.

<move verbose="true" todir="src">
	<mapper type="regex" from="^(.*)OldProject(.*)$$" to="\1NewProject 
\2" />
	<fileset dir="src">
		<include name="**/*.java">
	<fileset />
<move />

Also, if your new file names could conflict with the old ones, it  
might be better to do virtually the same thing, but by first copying  
to a temp location, then copying back.


On Aug 07, 2008, at 03:15, IsaakTaylor wrote:

> Hello,
> thanx for the answers.
> First, I'm using Maven Ant Task. I have a Java project and I want  
> to create
> an maven archetype (a project template out of a complete project).
> Like I said before, I have a directory with subdirs and they  
> contain files
> like
> My task is to rename all files that called OldProjectXXX to  
> in all directories.
> I could not find a way to do this with Maven (and some oder things)  
> so I
> started to use Ant Tasks.
> Regrets Isaac
> -- 
> View this message in context: 
> directory-and-subdirectory-tp18853422p18865315.html
> Sent from the Ant - Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message