tags:

views:

1261

answers:

3

Hi, I have used copydir to copy the directory. Actually my directory contains some sub directories. Out of which some contains file and other some contains again contain sub directories. Now I want to copy everything.

So how to copy all the contains of the directory using ant.

Thanks Sunil Kumar Sahoo

+4  A: 
  <copy todir="${dest.dir}" >  
        <fileset dir="${src.dir}" includes="**"/>  
 </copy>

believe that will do what you want...

Omnipresent
apparently, the `includes` is not necessary when you want everything (see answer by user *s1n*)
Abel
+3  A: 

You should only have to specify the directory (sans the includes property):

  <copy todir="../new/dir">
    <fileset dir="src_dir"/>
  </copy>

See the manual for more details and examples.

s1n
Was about to post the same advice. RTFM.
Alexander Pogrebnyak
+2  A: 

From the example here, you can write a simple ant file using copy task.

<project name="MyProject" default="copy" basedir=".">
    <target name="copy">
        <copy todir="./new/dir">
           <fileset dir="src_dir"/>
        </copy>
    </target>
</project>

This should copy everything inside src_dir (excluding it) to new/dir.

Hope this helps.

NawaMan