Reputation: 957
Say I have directory structure like this:
base_dir1/src_dir
base_dir2/dest_dir
How do I copy src_dir
(folder + contents) into dest_dir
.
If I use copy task like this:
<copy todir="base_dir2/dest_dir">
<fileset dir="base_dir1/src_dir"/>
</copy>
It will copy all the contents of src_dir
into dest_dir
, but will not create a src_dir
folder inside dest_dir
.
I can make it work by using the copy task like this:
<copy todir="base_dir2/dest_dir">
<fileset dir="base_dir1">
<include name="src_dir/"/>
</fileset>
</copy>
Is this the correct way or is there a better way to do it?
Upvotes: 0
Views: 133
Reputation: 52665
Alternately, you could do this.
<copy todir="base_dir2/dest_dir/src_dir">
<fileset dir="base_dir1/src_dir"/>
</copy>
The folder (or part of the folder) specified by todir
need not exist.
<fileset>
refers to contents of the specified folder (excluding it).
Upvotes: 1