<project name="CopyDirectory" default="CheckDirectoryExists">
  <!-- PARAMETERS
    dir - The directory to copy.
    todir - The directory to copy to.
  -->
  <target name="CopyDirectory" if="directory.exists">
    <copy todir="${todir}"><fileset dir="${dir}"/></copy>
  </target>

  <target name="CheckDirectoryExists" description="Checks if the directory to be copied exists">
    <!-- Check if directory exists -->
    <available file="${dir}" type="dir" property="directory.exists"/>
    <!-- Call copy directory target -->
    <antcall target="CopyDirectory"/>
  </target>
</project>

