ant-user mailing list archives

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


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

http://renamer4mac.com/

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.

HTH,
F

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 OldProjectXXX.java
> My task is to rename all files that called OldProjectXXX to  
> NewProjectX.java
> 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: http://www.nabble.com/rename-files-in- 
> directory-and-subdirectory-tp18853422p18865315.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


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


Mime
View raw message