Javatpoint Logo
Javatpoint Logo

Apache Ant Move Task

This task is used to move a file to new file or directory. It can also be used to move set of files to a new directory. By default destination files are overwritten if the files are already exists.

The file attribute is used to move a file or entire directory to a new destination directory.

Attribute Description Required
file The file or directory to be moved. Yes
preservelastmodified Preserve the last moved file name No
tofile The destination file. Yes
todir The destination directory. Yes
overwrite It overwrites existing files even if the destination files are newer. No
force It overwrites read-only destination files. No
filtering It indicates whether token filtering should take place during the move. No
flatten It ignores directory structure of source directory. No
includeEmptyDirs It copies empty directories. No
failonerror If false, log a warning message. No
quiet It does not log a warning message when the file to copy does not exist. No
verbose Log the files that are being moved. No
encoding It is used to specify encoding format. No
outputencoding The encoding to use when writing the files. No

Apache Ant Move Task Example

Moving file to new file.

Moving a file to a directory.

Moving a directory to new directory.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA