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 all 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. All files are included when omitted. No
includesfile the 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 files (except default excludes) are excluded when omitted. No
excludesfile the 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"). Default excludes are used when omitted. No
filtering indicates whether token filtering should take place during the copy No
flatten ignore directory structure of source directory, copy all files into a single directory, specified by the dest attribute (default is false). No
forceoverwrite overwrite existing files even if the destination files are newer (default is false). No

Examples

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

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

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

copies 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="mypackage/test/**"/>

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