![]()
|
CopyDescriptionCopies a file or FileSet to a new file or directory. By default, files are
only copied if the source file is newer than the destination file,
or when the destination file does not exist. However, you can explicitly
overwrite files with the FileSets are used to select a
set of files to copy.
To use a Parameters
Parameters specified as nested elementsfilesetFileSets are used to select
sets of files to copy.
To use a fileset, the mapperYou can define filename transformations by using a nested mapper element. The default mapper used by
filtersetFilterSets are used to replace
tokens in files that are copied.
To use a FilterSet, use the nested filterchainThe Copy task supports nested FilterChains. If <filterset> and <filterchain> elements are used inside the same <copy> task, all <filterchain> elements are processed first followed by <filterset> elements. ExamplesCopy a single file <copy file="myfile.txt" tofile="mycopy.txt"/> Copy a single file to a directory <copy file="myfile.txt" todir="../some/other/dir"/> Copy a directory to another directory <copy todir="../new/dir"> <fileset dir="src_dir"/> </copy> Copy a set of files to a directory <copy todir="../dest/dir"> <fileset dir="src_dir"> <exclude name="**/*.java"/> </fileset> </copy> <copy todir="../dest/dir"> <fileset dir="src_dir" excludes="**/*.java"/> </copy> Copy a set of files to a directory, appending
<copy todir="../backup/dir"> <fileset dir="src_dir"/> <mapper type="glob" from="*" to="*.bak"/> </copy> Copy a set of files to a directory, replacing @TITLE@ with Foo Bar in all files. <copy todir="../backup/dir"> <fileset dir="src_dir"/> <filterset> <filter token="TITLE" value="Foo Bar"/> </filterset> </copy> Unix Note: File permissions are not retained when files
are copied; they end up with the default Windows Note: If you copy a file to a directory where that file already exists, but with different casing, the copied file takes on the case of the original. The workaround is to delete the file in the destination directory before you copy it. Copyright © 2000-2002 Apache Software Foundation. All rights Reserved. |