- Apache ANT Tasks Tutorial
- ANT Tasks - Home
- ANT Tasks - Introduction
- ANT Tasks - Environment Setup
- Apache ANT Tasks Examples
- ANT Tasks - BaseName
- ANT Tasks - GZip
- ANT Tasks - GUnzip
- ANT Tasks - Chmod
- ANT Tasks - Concat
- ANT Tasks - Condition
- ANT Tasks - Copy
- ANT Tasks - Delete
- ANT Tasks - EAR
- ANT Tasks - Fail
- ANT Tasks - Import
- ANT Tasks - Java
- ANT Tasks - Javac
- ANT Tasks - Length
- ANT Tasks - LoadFile
- ANT Tasks - MkDir
- ANT Tasks - Move
- ANT Tasks - Sleep
- ANT Tasks - WAR
- ANT Tasks - Zip
- ANT Tasks -JAR
- Apache ANT Tasks Useful Resources
- Ant Tasks - Quick Guide
- Ant Tasks - Useful Resources
- Ant Tasks - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Apache Ant Tasks - Move
Move task moves a file to a new file or directory, or collections of files to a new directory. By default, the destination file is overwritten if it already exists. When overwrite is turned off, then files are only moved if the source file is newer than the destination file, or when the destination file does not exist.
|Sr.No||Attributes & Description|
The file or directory to move.
Give the moved files the same last modified time as the original source files.
The file to move to.
The directory to move to.
Overwrite existing files even if the destination files are newer.
Overwrite read-only destination files.
Indicates whether token filtering should take place during the move.
Ignore directory structure of source directory, copy all files into a single directory, specified by the todir attribute.
Copy empty directories included with the nested FileSet(s).
If false, log a warning message, but do not stop the build, when the file to copy does not exist or one of the nested filesets points to a directory that doesn't exist or an error occurs while moving.
If true and failonerror is false, then do not log a warning message when the file to copy does not exist or one of the nested filesets points to a directory that doesn't exist or an error occurs while copying.
Log the files that are being moved.
The encoding to assume when filter-copying the files.
The encoding to use when writing the files.
If true the task will process to all the mappings for a given source path. If false the task will only process the first file or directory. This attribute is only relevant if there is a mapper subelement.
The number of milliseconds leeway to give before deciding a file is out of date. This is needed because not every file system supports tracking the last modified time to the millisecond level. This can also be useful if source and target files live on separate machines with clocks being out of sync.
If Ant fails to delete a file or directory it will retry the operation once. If this flag is set to true it will perform a garbage collection before retrying the delete. Setting this flag to true is known to resolve some problems on Windows (where it defaults to true) but also for directory trees residing on an NFS share.
Create build.xml with the following content −
<?xml version="1.0"?> <project name="TutorialPoint" default="info"> <target name="info"> <move file="message.txt" tofile="message.txt.moved"/> </target> </project>
Running Ant on the above build file produces the following output −
F:\tutorialspoint\ant>ant Buildfile: F:\tutorialspoint\ant\build.xml info: [move] Moving 1 file to F:\tutorialspoint\ant BUILD SUCCESSFUL Total time: 0 seconds