One, copy command
Copy is primarily used for copying files and directories. Examples are as follows:
Example 1. To copy a single file:
<copy file="A.txt" tofile="B.txt"/>
Example 2. To copy a file directory:
<copy todir="dest_dir"> <fileset dir="src_dir"/></copy>
Example 3. Copy files to a different directory
<copy file="source.txt" todir="dest_dir"/>
Second, delete command
Delete the file or directory. Examples are as follows:
Example 1. Delete a file:
<delete file="A.txt"/>
Example 2. To delete a directory:
<delete dir="home/src"/>
Example 3. Delete all backup directories or empty directories:
<delete includeEmptyDirs="true"> <fileset dir="." includes="**/*.bak"/></delete>
Iii. mkdir Order
To create a directory:
<mkdir dir="home/src/bin"/>
Iv. Move Command
Move a file or directory. Examples are as follows:
Example 1. To move a single file:
<move file="source_file" tofile=”dest_file”/>
Example 2. To move a single file to another directory:
<move file="source_file" todir=”move_dir”/>
Example 3. To move a directory to another directory:
<move todir="new_dir"> <fileset dir="old_dir"/></move>
V. Echo command
The purpose of this task is to output information based on the level of the log or monitor.
It includes the message, file, append, and level four properties, as in the following example
<echo message="hello ant" file="home/msg.log" append="true" />
Author: itmyhome
Original: Wheat Field Technology Blog
Common commands for the ant Getting Started tutorial