Common commands for Ant getting started, ant getting started
I. copy command
Copy is mainly used to copy files and directories. Example:
Example 1. Copy a single file:
<copy file="A.txt" tofile="B.txt"/>
Example 2. copy the file directory:
<copy todir="dest_dir"> <fileset dir="src_dir"/></copy>
Example 3. copy the file to another directory
<copy file="source.txt" todir="dest_dir"/>
Ii. delete command
Delete a file or directory. Example:
Example 1. delete an object:
<delete file="A.txt"/>
Example 2. 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 command
Create directory:
<mkdir dir="home/src/bin"/>
Iv. move command
Move a file or directory. Example:
Example 1. Move a single file:
<move file="source_file" tofile=”dest_file”/>
Example 2. Move a single file to another directory:
<move file="source_file" todir=”move_dir”/>
Example 3. Move a directory to another directory:
<move todir="new_dir"> <fileset dir="old_dir"/></move>
5. echo command
This task outputs Information Based on the log or monitor level.
It includes four attributes: message, file, append, and level. The example is as follows:
<echo message="hello ant" file="home/msg.log" append="true" />
Author: itmyhome
Original article: wheat field technical blog