Copydir

Deprecated

This task has been deprecated. Use the Copy task instead.

Description

Copies a directory tree from the source to the destination.

It is possible to refine the set of files that are being copied. This can be done with the includes, includesfile, excludes, excludesfile and defaultexcludes attributes. With the includes or includesfile attribute you specify the files you want to have included by using patterns. The exclude or excludesfile attribute is used to specify the files you want to have excluded. This is also done with patterns. And finally with the defaultexcludes attribute, you can specify whether you want to use default exclusions or not. See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.

This task forms an implicit FileSet and supports most attributes of <fileset> (dir becomes src) as well as the nested <include>, <exclude> and <patternset> elements.

Parameters

Attribute Description Required
src the directory to copy. Yes
dest the directory to copy to. Yes
includes comma- or space-separated list of patterns of files that must be included. No; defaults to all (**)
includesfile name of a file. Each line of this file is taken to be an include pattern No
excludes comma- or space-separated list of patterns of files that must be excluded. No; defaults to default excludes or none if defaultexcludes is no
excludesfile name of a file. Each line of this file is taken to be an exclude pattern No
defaultexcludes indicates whether default excludes should be used or not (yes|no). No; defaults to yes
filtering indicates whether token filtering should take place during the copy No; default is false
flatten ignore directory structure of source directory, copy all files into a single directory, specified by the dest attribute. No; default is false
forceoverwrite overwrite existing files even if the destination files are newer. No; default is false

Examples

Copy the directory ${src}/resources to ${dist}.

<copydir src="${src}/resources"
         dest="${dist}"/>

Copy the directory ${src}/resources to ${dist} recursively. All .java files are copied, except for files with the name Test.java.

<copydir src="${src}/resources"
         dest="${dist}"
         includes="**/*.java"
         excludes="**/Test.java"/>

Copy the directory ${src}/resources to ${dist} recursively. All .java files are copied, except for the files under the mypackage/test directory.

<copydir src="${src}/resources"
         dest="${dist}"
         includes="**/*.java"
         excludes="mypackage/test/**"/>