<filesystem : Copy>

Description

Copies a file or directory to a new file or directory. Files are only copied if the source file is newer than the destination file, or when the destination file does not exist. It is possible to explicitly overwrite existing files.

This implementation is based on Arnout Kuiper's initial design document, the following mailing list discussions, and the copyfile/copydir tasks.

Parameters

Attribute Description Type Required?
flatten When copying directory trees, the files can be "flattened" into a single directory. If there are multiple files with the same name in the source directory tree, only the first file will be copied into the "flattened" directory, unless the forceoverwrite attribute is true. boolean ?
tofile Sets the destination file. File ?
encoding Sets the character encoding String ?
todir Sets the destination directory. File ?
file Sets a single source file to copy. File ?
verbose Used to force listing of all names of copied files. boolean ?
includeemptydirs Used to copy empty directories. boolean ?
overwrite Overwrite any existing destination file(s). boolean ?
enablemultiplemappings Attribute to handle mappers that return multiple mappings for a given source path. boolean ?
granularity The number of milliseconds leeway to give before deciding a target is out of date.

Default is 0 milliseconds, or 2 seconds on DOS systems.

long ?
outputencoding Sets the character encoding for output files. String ?
failonerror If false, note errors to the output but keep going. boolean ?
preservelastmodified Give the copied files the same last modified time as the original files. boolean ?
filtering If true, enables filtering. boolean ?

Parameters accepted as nested elements

<filterchain> ...

FilterChain may contain a chained set of filter readers.
Attribute Description Type Required
refid Makes this instance in effect a reference to another FilterChain instance.

You must not set another attribute or nest elements inside this element if you make it a reference.

Reference ?

<fileset> ...

Moved out of MatchingTask to make it a standalone object that could be referenced (by scripts for example).
Attribute Description Type Required
refid Reference ?
file File ?
dir File ?
defaultexcludes boolean ?
followsymlinks boolean ?
casesensitive boolean ?
excludes String ?
includesfile File ?
excludesfile File ?
includes String ?

<filterset> ...

A set of filters to be applied to something. A filter set may have begintoken and endtokens defined.
Attribute Description Type Required
begintoken Set the string used to id the beginning of a token. String ?
endtoken Set the string used to id the end of a token. String ?
refid Reference ?
recurse Set whether recursive token expansion is enabled. boolean ?
filtersfile Set the file containing the filters for this filterset. File ?

<mapper> ...

Element to define a FileNameMapper.
Attribute Description Type Required
classpath Set the classpath to load the FileNameMapper through (attribute). Path ?
classpathref Set the classpath to load the FileNameMapper through via reference (attribute). Reference ?
refid Make this Mapper instance a reference to another Mapper.

You must not set any other attribute if you make it a reference.

Reference ?
type Set the type of FileNameMapper to use. String ["identity", "flatten", "glob", "merge", "regexp", "package", "unpackage"] ?
classname Set the class name of the FileNameMapper to use. String ?
from Set the argument to FileNameMapper.setFrom String ?
to Set the argument to FileNameMapper.setTo String ?