views:

878

answers:

1

I have have a folder structure like so:

/PROJECT/PROJECT.html

/PROJECT/PROJECT_readme.txt

/PROJECT/PROJECT.css

/PROJECT/PROJECT.js

/PROJECT/abc_PROJECT_def.txt

/PROJECT/something.js

/PROJECT/other.txt

/PROJECT/somefolder/PROJECT_other.txt

I want to use ANT to copy the complete directory and also change the PROJECT string in the files or folder to a specified value e.g. mysuperproject, so the result folder structure is so :

/mysuperproject/mysuperproject.html

/mysuperproject/mysuperproject_readme.txt

/mysuperproject/mysuperproject.css

/mysuperproject/mysuperproject.js

/mysuperproject/abc_mysuperproject_def.txt

/mysuperproject/something.js

/mysuperproject/other.txt

/mysuperproject/somefolder/mysuperproject_other.txt

Is there a easy way to do that in ANT ?

+3  A: 

The Move task should suit you. Read the linked docs carefully.

It's a core task, so you can use it without downloading of configuring anything.

Bozho
I tried this but I can't seem to get that to work :<move todir="templates"> <fileset dir="${templates.dir}"> <include name="**/*"/> </fileset> <regexpmapper from="(.*)PROJECT(.*)$$" to="\1mysuperproject\2"/></move>
and what happens? any concrete error? I think you shouldn't expect others to write your ant task ;)
Bozho