Reputation: 1771
By using following ant script all the files will be copied from source.dir to build.dir
<target name="compile" description="">
<copy todir="${build.dir}">
<fileset dir="${source.dir}"/>
</copy>
</target>
means:
source/
1.html
2.html
html/
3.html
4.html
build/
1.html
2.html
html/
3.html
4.html
I want the following
source/
1.html
2.html
html/
3.html
4.html
build/
1.html
2.html
3.html
4.html
Can anyone help me out here, i am new in ant script!
Upvotes: 1
Views: 120
Reputation: 122424
If you want to manipulate the file names as you copy, copy you need a mapper
<copy todir="${build.dir}">
<fileset dir="${source.dir}"/>
<flattenmapper/>
</copy>
Upvotes: 2
Reputation: 12373
Use Ant Move Tag
Here is an example..
<move file="file.orig" todir="dir/to/move/to"/>
For multiple files ...
<move todir="some/new/dir">
<filelist dir="my/src/dir">
<file name="file1.txt"/>
<file name="file2.txt"/>
</filelist>
</move>
Upvotes: 1